W3cubDocs

/TensorFlow 1.15

tf.ragged.segment_ids_to_row_splits

View source on GitHub

Generates the RaggedTensor row_splits corresponding to a segmentation.

Returns an integer vector splits, where splits[0] = 0 and splits[i] = splits[i-1] + count(segment_ids==i). Example:

ragged.segment_ids_to_row_splits([0, 0, 0, 2, 2, 3, 4, 4, 4]).eval()
[ 0 3 3 5 6 9 ]
Args
segment_ids A 1-D integer Tensor.
num_segments A scalar integer indicating the number of segments. Defaults to max(segment_ids) + 1 (or zero if segment_ids is empty).
out_type The dtype for the return value. Defaults to segment_ids.dtype, or tf.int64 if segment_ids does not have a dtype.
name A name prefix for the returned tensor (optional).
Returns
A sorted 1-D integer Tensor, with shape=[num_segments + 1].

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/ragged/segment_ids_to_row_splits