计算张量 x 沿 axis 的累积和。
用法
tf.raw_ops.Cumsum(
x, axis, exclusive=False, reverse=False, name=None
)参数
-
xATensor.必须是以下类型之一:float32,float64,int32,uint8,int16,int8,complex64,int64,qint8,quint8,qint32,bfloat16,uint16,complex128,half,uint32,uint64.一种Tensor.必须是以下类型之一:float32,float64,int64,int32,uint8,uint16,int16,int8,complex64,complex128,qint8,quint8,qint32,half. -
axis一个Tensor。必须是以下类型之一:int32,int64。Tensor类型为int32(默认值:0)。必须在[-rank(x), rank(x))范围内。 -
exclusive可选的bool。默认为False。如果True,执行独占cumsum。 -
reverse可选的bool。默认为False。bool(默认值:False)。 -
name操作的名称(可选)。
返回
-
一个
Tensor。具有与x相同的类型。
默认情况下,此操作执行包含 cumsum,这意味着输入的第一个元素与输出的第一个元素相同:
tf.cumsum([a, b, c]) # => [a, a + b, a + b + c]
通过将 exclusive kwarg 设置为 True ,将执行独占 cumsum:
tf.cumsum([a, b, c], exclusive=True) # => [0, a, a + b]
通过将 reverse kwarg 设置为 True ,cumsum 以相反的方向执行:
tf.cumsum([a, b, c], reverse=True) # => [a + b + c, b + c, c]
这比使用单独的 tf.reverse 操作更有效。
reverse 和 exclusive kwargs 也可以组合:
tf.cumsum([a, b, c], exclusive=True, reverse=True) # => [b + c, c, 0]
相关用法
- Python tf.raw_ops.Cumprod用法及代码示例
- Python tf.raw_ops.CumulativeLogsumexp用法及代码示例
- Python tf.raw_ops.ComplexAbs用法及代码示例
- Python tf.raw_ops.Conv2D用法及代码示例
- Python tf.raw_ops.Cos用法及代码示例
- Python tf.raw_ops.Case用法及代码示例
- Python tf.raw_ops.CheckNumerics用法及代码示例
- Python tf.raw_ops.Conj用法及代码示例
- Python tf.raw_ops.Cosh用法及代码示例
- Python tf.raw_ops.Complex用法及代码示例
- Python tf.raw_ops.ConcatOffset用法及代码示例
- 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用法及代码示例
注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.raw_ops.Cumsum。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
