axis
- axis = 0 不仅可以表示按行操作
eg: 相加合并成一行import tensorflow as tf x = tf.constant([[1,2,3], [1,2,3]]) with tf.Session() as sess: print(tf.reduce_sum(x, axis=0).eval()) # [2 4 6]
- axis = 0 还可以表示竖直方向
import tensorflow as tf import numpy as np test = np.array([[1, 2, 3], [2, 3, 4]]) t = tf.argmax(test, axis=0) with tf.Session() as sess: print(t.eval()) # [1 1 1]
argmax
- 返回指定方向上最大值序号
感觉:
tensorflow的接口,总能嗅到广播的味道