If I want to check that all the elements in tnsr = tf.constant(...) are greater than 3, I can tf.reduce_all(tnsr > 3) to get a scalar boolean tensor. If I'm using eager execution, or @tf.function, I can then use that as a normal bool:
@tf.function
def foo(tnsr):
if tf.reduce_all(tnsr > 3):
...
but this doesn't work with autograph=False. What do I do then?
Other things I've tried:
tf.condreturns atf.Tensoreven fortrue_fn=lambda: Truebool(tf.reduce_all(tnsr > 3))fails for the same reason as above