返回張量列表的元素總和。
用法
tf.math.accumulate_n(
inputs, shape=None, tensor_dtype=None, name=None
)參數
-
inputsTensor對象的列表,每個對象都具有相同的形狀和類型。 -
shapeinputs元素的預期形狀(可選)。還控製此操作的輸出形狀,這可能會影響其他操作中的類型推斷。None的值表示“從inputs中的形狀推斷輸入形狀”。 -
tensor_dtypeinputs的預期數據類型(可選)。None的值表示“從inputs[0]推斷輸入 dtype”。 -
name操作的名稱(可選)。
返回
-
與
inputs的元素具有相同形狀和類型的Tensor。
拋出
-
ValueError如果inputs的形狀和數據類型不同,或者無法推斷出形狀。
可選地,通過 shape 和 tensor_dtype 進行形狀和類型檢查,否則,這些是推斷的。
accumulate_n 執行與 tf.math.add_n 相同的操作。
例如:
a = tf.constant([[1, 2], [3, 4]])
b = tf.constant([[5, 0], [0, 6]])
tf.math.accumulate_n([a, b, a]) # [[7, 4], [6, 14]]
# Explicitly pass shape and type
tf.math.accumulate_n([a, b, a], shape=[2, 2], tensor_dtype=tf.int32)
# [[7, 4],
# [6, 14]]
相關用法
- Python tf.math.acosh用法及代碼示例
- Python tf.math.acos用法及代碼示例
- Python tf.math.angle用法及代碼示例
- Python tf.math.add_n用法及代碼示例
- Python tf.math.argmax用法及代碼示例
- Python tf.math.atan用法及代碼示例
- Python tf.math.argmin用法及代碼示例
- Python tf.math.add用法及代碼示例
- Python tf.math.asin用法及代碼示例
- Python tf.math.asinh用法及代碼示例
- Python tf.math.abs用法及代碼示例
- Python tf.math.atan2用法及代碼示例
- Python tf.math.atanh用法及代碼示例
- Python tf.math.special.fresnel_cos用法及代碼示例
- Python tf.math.polyval用法及代碼示例
- Python tf.math.is_finite用法及代碼示例
- Python tf.math.special.bessel_k0e用法及代碼示例
- Python tf.math.invert_permutation用法及代碼示例
- Python tf.math.segment_prod用法及代碼示例
- Python tf.math.bincount用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.math.accumulate_n。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
