Skip to content
Frank Seide edited this page Aug 16, 2016 · 4 revisions

Elementwise selecting of one of two inputs given a condition.

If (condition, thenValue, elseValue)

Parameters

  • condition: condition according to which element values are selected
  • thenValue: element value selected if condition element is not 0
  • elseValue: element value selected if condition element is 0

Return Value

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.

Description

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.

Clone this wiki locally