計算張量 x
沿 axis
的累積乘積。
用法
tf.raw_ops.Cumprod(
x, axis, exclusive=False, reverse=False, name=None
)
參數
-
x
ATensor
.必須是以下類型之一: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
,執行獨占 cumprod。 -
reverse
可選的bool
。默認為False
。bool
(默認值:False)。 -
name
操作的名稱(可選)。
返回
-
一個
Tensor
。具有與x
相同的類型。
默認情況下,此操作執行包含 cumprod,這意味著輸入的第一個元素與輸出的第一個元素相同:
tf.cumprod([a, b, c]) # => [a, a * b, a * b * c]
通過將 exclusive
kwarg 設置為 True
,將執行獨占 cumprod:
tf.cumprod([a, b, c], exclusive=True) # => [1, a, a * b]
通過將 reverse
kwarg 設置為 True
,cumprod 以相反的方向執行:
tf.cumprod([a, b, c], reverse=True) # => [a * b * c, b * c, c]
這比使用單獨的 tf.reverse
操作更有效。
reverse
和 exclusive
kwargs 也可以組合:
tf.cumprod([a, b, c], exclusive=True, reverse=True) # => [b * c, c, 1]
相關用法
- Python tf.raw_ops.Cumsum用法及代碼示例
- 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.Cumprod。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。