MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / with_rank

Method with_rank

tensorflow/python/framework/tensor_shape.py:997–1015  ·  view source on GitHub ↗

Returns a shape based on `self` with the given rank. This method promotes a completely unknown shape to one with a known rank. Args: rank: An integer. Returns: A shape that is at least as specific as `self` with the given rank. Raises: ValueError: If `self`

(self, rank)

Source from the content-addressed store, hash-verified

995 raise ValueError("Shape %s must have rank %d" % (self, rank))
996
997 def with_rank(self, rank):
998 """Returns a shape based on `self` with the given rank.
999
1000 This method promotes a completely unknown shape to one with a
1001 known rank.
1002
1003 Args:
1004 rank: An integer.
1005
1006 Returns:
1007 A shape that is at least as specific as `self` with the given rank.
1008
1009 Raises:
1010 ValueError: If `self` does not represent a shape with the given `rank`.
1011 """
1012 try:
1013 return self.merge_with(unknown_shape(rank=rank))
1014 except ValueError:
1015 raise ValueError("Shape %s must have rank %d" % (self, rank))
1016
1017 def with_rank_at_least(self, rank):
1018 """Returns a shape based on `self` with at least the given rank.

Callers 15

compute_output_shapeMethod · 0.95
_project_inputMethod · 0.80
callMethod · 0.80
_check_rankFunction · 0.80
_reverse_seqFunction · 0.80
attention_decoderFunction · 0.80
callMethod · 0.80
_make_tf_featuresMethod · 0.80
_make_tf_featuresMethod · 0.80
_highwayMethod · 0.80
buildMethod · 0.80
callMethod · 0.80

Calls 2

merge_withMethod · 0.95
unknown_shapeFunction · 0.70

Tested by

no test coverage detected