Reputation: 98
Using tensorflow reduce_sum but getting undesired output. I am trying to calculate the below thing:
x = tf.constant([[1,1,1],[1,1,1]])
tf.reduce_sum(x,0)
expected output = [2, 2, 2]
actual output = <tf.Tensor 'Sum:0' shape=() dtype=int32>
Upvotes: 0
Views: 60
Reputation: 1822
If you want to display, you need to be in a session and use eval()
import tensorflow as tf
sess = tf.InteractiveSession()
x = tf.constant([[1,1,1],[1,1,1]])
tf.reduce_sum(x,0).eval()
Upvotes: 1