returnn.frontend.cond#

Conditional execution.

Why did we choose this API? To allow for both eager-based and graph-based frameworks, and also to avoid any magic happening here. https://github.com/rwth-i6/returnn/issues/1282

returnn.frontend.cond.cond(pred: bool | Tensor, true_fn: Callable[[], T], false_fn: Callable[[], T]) T[source]#
Parameters:
  • pred

  • true_fn

  • false_fn

Returns:

true_fn() if pred else false_fn()