<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/transform/blob/v1.21.0/tensorflow_transform/mappers.py#L1373-L1415) |

Returns a `Tensor` of indices within each segment.

    tft.segment_indices(
        segment_ids: tf.Tensor, name: Optional[str] = None
    ) -> tf.Tensor

segment_ids should be a sequence of non-decreasing non-negative integers that
define a set of segments, e.g. \[0, 0, 1, 2, 2, 2\] defines 3 segments of length
2, 1 and 3. The return value is a `Tensor` containing the indices within each
segment.

#### Example:

*** ** * ** ***

    >>> result = tft.segment_indices(tf.constant([0, 0, 1, 2, 2, 2]))
    >>> print(result)
    tf.Tensor([0 1 0 0 1 2], shape=(6,), dtype=int32)

<br />

<br />

<br />

| ## Args ||
|---|---|

<br />

*** ** * ** ***

segment_ids: A 1-d `Tensor` containing an non-decreasing sequence of
non-negative integers with type [`tf.int32`](https://www.tensorflow.org/api_docs/python/tf#int32) or [`tf.int64`](https://www.tensorflow.org/api_docs/python/tf#int64).
name: (Optional) A name for this operation.

<br />

<br />

<br />

| ## Returns ||
|---|---|

<br />

*** ** * ** ***

A `Tensor` containing the indices within each segment.