Python 如何选择张量中的项目组

Python 如何选择张量中的项目组,python,tensorflow,Python,Tensorflow,在张量流中。 如何选择所有三元组(x,y,c),其中c>0.5 我知道这可能是一个非常基本的问题,但我对Tensorflow非常陌生。使用tf.where。比如说, x = np.random.rand(20,3) sess = tf.Session() print x[tf.where(tf.greater(x[:,2], 0.5)).eval(session=sess)] 或者稍微干净一点, tf.boolean_mask(x,tf.greater(x[:,2],0.5)).eval(s

在张量流中。 如何选择所有三元组(
x,y,c
),其中
c>0.5


我知道这可能是一个非常基本的问题,但我对Tensorflow非常陌生。

使用
tf.where
。比如说,

x = np.random.rand(20,3)
sess = tf.Session()
print x[tf.where(tf.greater(x[:,2], 0.5)).eval(session=sess)]
或者稍微干净一点,
tf.boolean_mask(x,tf.greater(x[:,2],0.5)).eval(session=sess)

我在使用
tf时遇到了一些困难。谢谢:)