Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

tf.reduce_sum()

Computes the sum of elements across dimensions of a tensor. 

x = tf.constant([[1, 1, 1], [1, 1, 1]])
tf.reduce_sum(x)  # 6
tf.reduce_sum(x, 0)  # [2, 2, 2]
tf.reduce_sum(x, 1)  # [3, 3]
tf.reduce_sum(x, 1, keepdims=True)  # [[3], [3]]
tf.reduce_sum(x, [0, 1])  # 6
Source by www.tensorflow.org #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
4+8 =