tf.keras.backend.switch(
condition,
then_expression,
else_expression
)
Defined in tensorflow/python/keras/backend.py
.
Switches between two operations depending on a scalar value.
Note that both then_expression
and else_expression
should be symbolic tensors of the same shape.
Arguments:
condition
: tensor (int
orbool
).then_expression
: either a tensor, or a callable that returns a tensor.else_expression
: either a tensor, or a callable that returns a tensor.
Returns:
The selected tensor.
Raises:
ValueError
: If rank ofcondition
is greater than rank of expressions.