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

Method shape

tensorflow/python/ops/ragged/ragged_tensor.py:813–834  ·  view source on GitHub ↗

The statically known shape of this ragged tensor. Returns: A `TensorShape` containing the statically known shape of this ragged tensor. Ragged dimensions have a size of `None`. Examples: ```python >>> ragged.constant([[0], [1, 2]]).shape TensorShape([Dimensi

(self)

Source from the content-addressed store, hash-verified

811
812 @property
813 def shape(self):
814 """The statically known shape of this ragged tensor.
815
816 Returns:
817 A `TensorShape` containing the statically known shape of this ragged
818 tensor. Ragged dimensions have a size of `None`.
819
820 Examples:
821
822 ```python
823 >>> ragged.constant([[0], [1, 2]]).shape
824 TensorShape([Dimension(2), Dimension(None)])
825
826 >>> ragged.constant([[[0, 1]], [[1, 2], [3, 4]]], ragged_rank=1).shape
827 TensorShape([Dimension(2), Dimension(None), Dimension(2)
828 ```
829 """
830 nrows = tensor_shape.dimension_at_index(self._row_splits.shape, 0) - 1
831
832 values_shape = self._values.shape
833 value_shape = values_shape[1:]
834 return tensor_shape.TensorShape([nrows, None]).concatenate(value_shape)
835
836 @property
837 def ragged_rank(self):

Callers 15

assertSameShapeMethod · 0.45
_zipMethod · 0.45
ragged_reduce_aggregateFunction · 0.45
boolean_maskFunction · 0.45
_nrowsFunction · 0.45
gather_ndFunction · 0.45
_ragged_gather_gradFunction · 0.45
_ragged_getitemFunction · 0.45
nrowsMethod · 0.45

Calls 1

concatenateMethod · 0.45

Tested by 2

assertSameShapeMethod · 0.36
_zipMethod · 0.36