import tensorflow as tf
sess = tf.InteractiveSession()
x = tf.Variable([[2.0, 3.0],[4.0, 12.0]])
x.initializer.run() tf.reduce_mean(x).eval()
5.25
tf.reduce_mean(x,1).eval()
array([ 2.5, 8. ], dtype=float32)
tf.reduce_mean(x,0).eval()
array([ 3. , 7.5], dtype=float32)
sess.close()