首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >tensorflow tf,argmax()函数怎么理解?

tensorflow tf,argmax()函数怎么理解?

提问于 2018-10-17 16:59:20
回答 1关注 0查看 1.2K
代码语言:javascript
复制
下面代码为什么得到这样的输出?
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

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档