tf.argmax(input,axis)根据axis取值的不同返回每行或者每列最大值的索引. 代码如下: import tensorflow as tfimport numpy as npsess=tf.Session()a = np.array([[1, 2, 3], [2, 3, 4], [5, 4, 3], [8, 7, 2]])a0=tf.argmax(a,axis=0)a1=tf.argmax(a,axis=1)a0=sess.run(a0)a1=sess.run(a1)b = np…