I understand that tf.where will return the locations of True values, so that I could use the result\'s shape[0] to get the number of <
tf.where
True
shape[0]
I think this is the easiest way to do it:
In [38]: myOtherTensor = tf.constant([[True, True], [False, True]]) In [39]: if_true = tf.count_nonzero(myOtherTensor) In [40]: sess.run(if_true) Out[40]: 3