計算張量 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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
