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

Method row_starts

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

Returns the start indices for rows in this ragged tensor. These indices specify where the values for each row begin in `self.values`. `rt.row_starts()` is equal to `rt.row_splits[:-1]`. Args: name: A name prefix for the returned tensor (optional). Returns: A 1-D integ

(self, name=None)

Source from the content-addressed store, hash-verified

1052 return array_ops.shape(self.row_splits, out_type=out_type)[0] - 1
1053
1054 def row_starts(self, name=None):
1055 """Returns the start indices for rows in this ragged tensor.
1056
1057 These indices specify where the values for each row begin in
1058 `self.values`. `rt.row_starts()` is equal to `rt.row_splits[:-1]`.
1059
1060 Args:
1061 name: A name prefix for the returned tensor (optional).
1062
1063 Returns:
1064 A 1-D integer Tensor with shape `[nrows]`.
1065 The returned tensor is nonnegative, and is sorted in ascending order.
1066
1067 #### Example:
1068 ```python
1069 >>> rt = ragged.constant([[3, 1, 4, 1], [], [5, 9, 2], [6], []])
1070 >>> rt.values
1071 tf.Tensor([3, 1, 4, 1, 5, 9, 2, 6])
1072 >>> rt.row_starts() # indices of row starts in rt.values
1073 tf.Tensor([0, 4, 4, 7, 8])
1074 ```
1075 """
1076 with ops.name_scope(name, "RaggedRowStarts", [self]):
1077 return self.row_splits[:-1]
1078
1079 def row_limits(self, name=None):
1080 """Returns the limit indices for rows in this ragged tensor.

Calls 1

name_scopeMethod · 0.45