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)
Args |
segment_ids
|
A 1-d Tensor containing an non-decreasing sequence of
non-negative integers with type tf.int32 or tf.int64 .
|
name
|
(Optional) A name for this operation.
|
Returns |
A Tensor containing the indices within each segment.
|