summaryrefslogtreecommitdiff
path: root/tensorflow/tf-cond.py
blob: 13c1bc311588887b6a75e0213266d696f11604a3 (plain)
1
2
3
4
5
6
7
8
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)