smart_cond

tfsnippet.ops.smart_cond(cond, true_fn, false_fn, name=None)

Execute true_fn or false_fn according to cond.

Parameters:
  • cond (bool or tf.Tensor) – A bool constant or a tensor.
  • true_fn (() -> tf.Tensor) – The function of the true branch.
  • false_fn (() -> tf.Tensor) – The function of the false branch.
  • name (str) – Default name of the name scope. If not specified, generate one according to the method name.
Returns:

The output tensor.

Return type:

tf.Tensor