[英]Extract indexes from multi-hot vector in Tensorflow
如何从Tensorflow中的多热张量中提取索引?
举些例子,
a = (1, 1, 0, 1, 0, 0, 0)
然后,输出应为
output = (0, 1, 3)
如果你是这个意思
a = tf.Variable(initial_value = [1, 1, 0, 1, 0, 0, 0])
print( sess.run( tf.where(tf.equal(a, tf.constant(1)) )))
那么输出就是这个。
[[0] [1] [3]]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.