生成与分段对应的 RaggedTensor row_splits。
用法
tf.ragged.segment_ids_to_row_splits(
segment_ids, num_segments=None, out_type=None, name=None
)参数
-
segment_ids一维整数张量。 -
num_segments一个标量整数,指示段数。默认为max(segment_ids) + 1(如果segment_ids为空,则为零)。 -
out_type返回值的 dtype。默认为segment_ids.dtype或tf.int64如果segment_ids没有数据类型。 -
name返回张量的名称前缀(可选)。
返回
-
排序后的一维整数张量,带有
shape=[num_segments + 1]。
返回一个整数向量 splits ,其中 splits[0] = 0 和 splits[i] = splits[i-1] + count(segment_ids==i) 。例子:
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)
相关用法
- Python tf.ragged.stack_dynamic_partitions用法及代码示例
- Python tf.ragged.stack用法及代码示例
- Python tf.ragged.cross用法及代码示例
- Python tf.ragged.boolean_mask用法及代码示例
- Python tf.ragged.map_flat_values用法及代码示例
- Python tf.ragged.range用法及代码示例
- Python tf.ragged.row_splits_to_segment_ids用法及代码示例
- Python tf.ragged.cross_hashed用法及代码示例
- Python tf.ragged.constant用法及代码示例
- Python tf.raw_ops.TPUReplicatedInput用法及代码示例
- Python tf.raw_ops.Bitcast用法及代码示例
- Python tf.raw_ops.SelfAdjointEigV2用法及代码示例
- Python tf.raw_ops.BatchMatMul用法及代码示例
- Python tf.raw_ops.OneHot用法及代码示例
- Python tf.raw_ops.ResourceScatterNdSub用法及代码示例
- Python tf.raw_ops.ReadVariableXlaSplitND用法及代码示例
- Python tf.raw_ops.GatherV2用法及代码示例
- Python tf.raw_ops.Expm1用法及代码示例
- Python tf.range用法及代码示例
- Python tf.raw_ops.BitwiseAnd用法及代码示例
注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.ragged.segment_ids_to_row_splits。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
