生成對應於 RaggedTensor row_splits 的分段。
用法
tf.ragged.row_splits_to_segment_ids(
splits, name=None, out_type=None
)參數
-
splits排序的一維整數張量。splits[0]必須為零。 -
name返回張量的名稱前綴(可選)。 -
out_type返回值的 dtype。默認為splits.dtype或tf.int64如果splits沒有數據類型。
返回
-
排序後的一維整數張量,帶有
shape=[splits[-1]]
拋出
-
ValueError如果splits無效。
返回一個整數向量 segment_ids ,其中 segment_ids[i] == j 如果 splits[j] <= i < splits[j+1] 。例子:
print(tf.ragged.row_splits_to_segment_ids([0, 3, 3, 5, 6, 9]))
tf.Tensor([0 0 0 2 2 3 4 4 4], shape=(9,), dtype=int64)
相關用法
- Python tf.ragged.range用法及代碼示例
- Python tf.ragged.cross用法及代碼示例
- Python tf.ragged.stack_dynamic_partitions用法及代碼示例
- Python tf.ragged.boolean_mask用法及代碼示例
- Python tf.ragged.stack用法及代碼示例
- Python tf.ragged.map_flat_values用法及代碼示例
- Python tf.ragged.cross_hashed用法及代碼示例
- Python tf.ragged.segment_ids_to_row_splits用法及代碼示例
- 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.row_splits_to_segment_ids。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
