tf.where 实例2

来源:互联网 发布:大数据分析平台有哪些 编辑:程序博客网 时间:2024/05/24 00:57

找两个等长的数组的相同值的index

import tensorflow as tfa = tf.constant([1,2,3,4,5])b = tf.constant([1,0,3,0,5])c = tf.where(tf.equal(a,b))print(a.get_shape())print(b.get_shape())print(c.get_shape())sess = tf.Session()print(sess.run(c))

print结果
[[0]
[2]
[4]]

原创粉丝点击