tf.ragged.row_splits_to_segment_ids

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

Defined in tensorflow/python/ops/ragged/segment_id_ops.py.

Generates the segmentation corresponding to a RaggedTensor row_splits.

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

>>> ragged.row_splits_to_segment_ids([0, 3, 3, 5, 6, 9]).eval()
[ 0 0 0 2 2 3 4 4 4 ]

Args:

  • splits: A sorted 1-D int64 Tensor. splits[0] must be zero.
  • name: A name prefix for the returned tensor (optional).

Returns:

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

Raises:

  • ValueError: If splits is invalid.