tf.ragged.row_splits_to_segment_ids

View source on GitHub

Generates the segmentation corresponding to a RaggedTensor row_splits.

tf.ragged.row_splits_to_segment_ids(
    splits, name=None, out_type=None
)

Returns an integer vector segment_ids, where segment_ids[i] == j if splits[j] <= i < splits[j+1]. Example:

>>> print(tf.ragged.row_splits_to_segment_ids([0, 3, 3, 5, 6, 9]))
 tf.Tensor([0 0 0 2 2 3 4 4 4], shape=(9,), dtype=int64)

Args:

Returns:

A sorted 1-D integer Tensor, with shape=[splits[-1]]

Raises: