tf.ragged.segment_ids_to_row_splits
Stay organized with collections
Save and categorize content based on your preferences.
Generates the RaggedTensor row_splits
corresponding to a segmentation.
tf.ragged.segment_ids_to_row_splits(
segment_ids, num_segments=None, out_type=None, name=None
)
Returns an integer vector splits
, where splits[0] = 0
and
splits[i] = splits[i-1] + count(segment_ids==i)
. Example:
print(tf.ragged.segment_ids_to_row_splits([0, 0, 0, 2, 2, 3, 4, 4, 4]))
tf.Tensor([0 3 3 5 6 9], shape=(6,), dtype=int64)
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] .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2021-08-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2021-08-16 UTC."],[],[]]