tf.boolean_mask()
tf.boolean_mask()
将输入的数组挑出想要的数据输出
参数:
tf.boolean_mask(
tensor,
mask,
name='boolean_mask',
axis=None
)
使用案例:
import tensorflow as tf
a = [1, 2, 3, 4]
mask = [True, False, True, False]
sess = tf.Session()
print(sess.run(tf.boolean_mask(a, mask))) #[1 3]