使用tensorflow reduce_sum但获得不需要的输出。我想计算下面的事情:
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>
如果要显示,则需要进入会话并使用eval()
import tensorflow as tf
sess = tf.InteractiveSession()
x = tf.constant([[1,1,1],[1,1,1]])
tf.reduce_sum(x,0).eval()