tf.boolean_mask()

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/fyq201749/article/details/82776968

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]

猜你喜欢

转载自blog.csdn.net/fyq201749/article/details/82776968
tf