View source on GitHub
  
 | 
Returns the element-wise sum of a list of tensors.
tf.math.accumulate_n(
    inputs, shape=None, tensor_dtype=None, name=None
)
Optionally, pass shape and tensor_dtype for shape and type checking,
otherwise, these are inferred.
accumulate_n performs the same operation as tf.math.add_n.
For example:
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]]
Returns | |
|---|---|
A Tensor of same shape and type as the elements of inputs.
 | 
Raises | |
|---|---|
ValueError
 | 
If inputs don't all have same shape and dtype or the shape
cannot be inferred.
 | 
    View source on GitHub