下面代码为什么得到这样的输出?
import tensorflow as tf
import numpy as np
test= np.array([[[1,2],[2,3]],[[4,5],[6,7]],[[3,9],[4,6]],[[6,3],[4,8]] ])
print("**********************")
print(test)
print(test.shape)
print("***********************")
x0 = tf.argmax(test,0)
y0 = tf.Session().run(x0)
x1 = tf.argmax(test, 1)
y1 = tf.Session().run(x1)
x2 = tf.argmax(test, 2)
y2 = tf.Session().run(x2)
print("xxxxxxxxxxxxx")
print(y0)
print("xxxxxxxxxxxxx")
print(y1)
print("xxxxxxxxxxxxx")
print(y2)
输出:
**********************
[[[1 2]
[2 3]]
[[4 5]
[6 7]]
[[3 9]
[4 6]]
[[6 3]
[4 8]]]
(4, 2, 2)
***********************
xxxxxxxxxxxxx
[[3 2]
[1 3]]
xxxxxxxxxxxxx
[[1 1]
[1 1]
[1 0]
[0 1]]
xxxxxxxxxxxxx
[[1 1]
[1 1]
[1 1]
[0 1]]
Process finished with exit code 0
相似问题