dimension=0:按列查找;spa
dimension=1:按行查找;code
1 a = tf.constant([1.,2.,3.,0.,9.,]) 2 b = tf.constant([[1,2,3],[3,2,1],[4,5,6],[6,5,4]]) 3 with tf.Session() as sess: 4 sess.run(tf.argmax(a, 0)) 5 with tf.Session() as sess: 6 sess.run(tf.argmax(b, 0)) 7 with tf.Session() as sess: 8 sess.run(tf.argmax(b, 1))
4blog
[3, 2, 2]input
[2, 0 ,2, 0]it