-
Notifications
You must be signed in to change notification settings - Fork 4.3k
If Operation
Frank Seide edited this page Aug 16, 2016
·
6 revisions
Elementwise selecting of one of two inputs given a condition.
If (condition, thenValue, elseValue)
-
condition
: condition according to which element values are selected -
thenValue
: element value selected ifcondition
element is not 0 -
elseValue
: element value selected ifcondition
element is 0
Sparse values are currently not supported.
A tensor of the dimension of the inputs. If any of the inputs have dimensions of 1, broadcasting is applied; in that case, the output dimension becomes the maximum over the corresponding three arguments' dimensions.
If()
selects elements from two inputs based on a condition, in an elementwise fashion.
For every input element where condition
is non-0, the corresponding element from thenValue
is chosen; and where condition
is 0, the corresponding elseValue
element is chosen.
This function supports broadcasting. For example, it is possible that the condition is a scalar, or one of the inputs is a constant tensor without time dimension.