diff options
-rw-r--r-- | tensorflow/tf-cond.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tensorflow/tf-cond.py b/tensorflow/tf-cond.py new file mode 100644 index 0000000..13c1bc3 --- /dev/null +++ b/tensorflow/tf-cond.py @@ -0,0 +1,9 @@ +import tensorflow as tf + +sess = tf.Session() +x = tf.constant(0) +a = sess.run( + [tf.cond(tf.equal(tf.count_nonzero(x), 0), lambda: tf.constant(True, name="b"), lambda: tf.constant(False,name="a"))] +) + +print(a) |