沿张量的稀疏段计算总和。
用法
tf.raw_ops.SparseSegmentSum(
data, indices, segment_ids, name=None
)参数
-
data一个Tensor。必须是以下类型之一:float32,float64,int32,uint8,int16,int8,int64,bfloat16,uint16,half,uint32,uint64。 -
indices一个Tensor。必须是以下类型之一:int32,int64。一维张量。与segment_ids具有相同的等级。 -
segment_ids一个Tensor。必须是以下类型之一:int32,int64。一维张量。值应该排序并且可以重复。 -
name操作的名称(可选)。
返回
-
一个
Tensor。具有与data相同的类型。
阅读分段部分以了解分段的说明。
与 SegmentSum 类似,但 segment_ids 的排名可以小于 data 的第一个维度,选择维度 0 的子集,由 indices 指定。
例如:
c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]])
# Select two rows, one segment.
tf.sparse_segment_sum(c, tf.constant([0, 1]), tf.constant([0, 0]))
# => [[0 0 0 0]]
# Select two rows, two segment.
tf.sparse_segment_sum(c, tf.constant([0, 1]), tf.constant([0, 1]))
# => [[ 1 2 3 4]
# [-1 -2 -3 -4]]
# Select all rows, two segments.
tf.sparse_segment_sum(c, tf.constant([0, 1, 2]), tf.constant([0, 0, 1]))
# => [[0 0 0 0]
# [5 6 7 8]]
# Which is equivalent to:
tf.segment_sum(c, tf.constant([0, 0, 1]))
相关用法
- Python tf.raw_ops.SparseSegmentSumWithNumSegments用法及代码示例
- Python tf.raw_ops.SparseSlice用法及代码示例
- Python tf.raw_ops.SparseSplit用法及代码示例
- Python tf.raw_ops.SparseCrossV2用法及代码示例
- Python tf.raw_ops.SparseCross用法及代码示例
- Python tf.raw_ops.SparseConcat用法及代码示例
- Python tf.raw_ops.SparseMatrixSparseMatMul用法及代码示例
- Python tf.raw_ops.SparseMatrixOrderingAMD用法及代码示例
- Python tf.raw_ops.SparseFillEmptyRows用法及代码示例
- Python tf.raw_ops.SparseToDense用法及代码示例
- Python tf.raw_ops.SparseMatrixSparseCholesky用法及代码示例
- Python tf.raw_ops.SparseMatrixMatMul用法及代码示例
- Python tf.raw_ops.SparseCrossHashed用法及代码示例
- Python tf.raw_ops.SpaceToDepth用法及代码示例
- Python tf.raw_ops.SpaceToBatch用法及代码示例
- Python tf.raw_ops.SpaceToBatchND用法及代码示例
- Python tf.raw_ops.SelfAdjointEigV2用法及代码示例
- Python tf.raw_ops.Size用法及代码示例
- Python tf.raw_ops.ScatterUpdate用法及代码示例
- Python tf.raw_ops.ScatterNdUpdate用法及代码示例
注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.raw_ops.SparseSegmentSum。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
