码迷,mamicode.com
首页 > 其他好文 > 详细

tensorflow-argmax

时间:2018-11-21 00:17:28      阅读:170      评论:0      收藏:0      [点我收藏+]

标签:tac   ESS   equal   int   argmax   tensor   run   code   imp   

import numpy as np x=[1,3,4] x1=np.equal(x,4) x2=np.equal(x,3) x4=np.equal(x,1) z=np.stack(np.int32([x1,x2,x4])) print z print np.argmax(z)
[[0 0 1]
 [0 1 0]
 [1 0 0]]
2
import tensorflow as tf
x=[1,3,4]
x1=tf.equal(x,4)
x2=tf.equal(x,3)
x4=tf.equal(x,1)
z=tf.stack(tf.to_int32([x1,x2,x4]))
with tf.Session() as sess:
    print sess.run(z)
    print sess.run(tf.argmax(z))
[[0 0 1]
 [0 1 0]
 [1 0 0]]
[2 1 0]

tensorflow-argmax

标签:tac   ESS   equal   int   argmax   tensor   run   code   imp   

原文地址:http://blog.51cto.com/13959448/2319552

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!