(pred, true_fn, false_fn)
A version of tf.cond that tries to evaluate the condition.
A version of tf.cond that tries to evaluate the condition.
A version of tf . cond that tries to evaluate the condition .
def cond(pred, true_fn, false_fn):
  """A version of tf.cond that tries to evaluate the condition."""
  v = get_static_value(pred)
  if v is None:
    return tf.cond(pred, true_fn, false_fn)
  if v:
    return true_fn()
  else:
    return false_fn()
def cond ( pred , true_fn , false_fn ) : v = get_static_value ( pred ) if v is None : return tf . cond ( pred , true_fn , false_fn ) if v : return true_fn ( ) else : return false_fn ( )