tf.where 实例

来源:互联网 发布:淘宝上925银饰品真假 编辑:程序博客网 时间:2024/05/24 02:45

找出tensor里所有True值的index

import tensorflow as tfa = tf.constant([False,False,True,False,True],dtype=tf.bool)b = tf.where(tf.equal(a,True))sess = tf.Session()print(sess.run(b))

print结果
[[2]
[4]]

原创粉丝点击