Trying to find a similar operation to .any()
, .all()
methods that will work on a tensor. Here is a scenario:
a = tf.Variable([True, False, True], dtype=tf.bool)
# this is how I do it right now
has_true = a.reduce_sum(tf.cast(a, tf.float32))
# this is what I'm looking for
has_true = a.any()
Currently converting my boolean tensor into int
using reduce_sum
to see if there are any truths in it. Is there a cleaner way to perform this operation?