chainer.functions.where

chainer.functions.where(condition, x, y)[source]

Choose elements depending on condition.

This function choose values depending on a given condition. All condition, x, and y must have the same shape.

Parameters:
  • condition (Variable) – Variable containing the condition. Only boolean array is permitted.
  • x (Variable) – Variable chosen when condition is True.
  • y (Variable) – Variable chosen when condition is False.
Returns:

Variable containing chosen values.

Return type:

Variable