tf.contrib.framework.smart_cond(
pred,
true_fn=None,
false_fn=None,
name=None
)
Defined in tensorflow/python/framework/smart_cond.py
.
Return either true_fn()
if predicate pred
is true else false_fn()
.
If pred
is a bool or has a constant value, we return either true_fn()
or false_fn()
, otherwise we use tf.cond
to dynamically route to both.
Arguments:
pred
: A scalar determining whether to return the result oftrue_fn
orfalse_fn
.true_fn
: The callable to be performed if pred is true.false_fn
: The callable to be performed if pred is false.name
: Optional name prefix when usingtf.cond
.
Returns:
Tensors returned by the call to either true_fn
or false_fn
.
Raises:
TypeError
: Iftrue_fn
orfalse_fn
is not callable.