cupy.where

cupy.where = <function where>

Return elements, either from x or y, depending on condition.

If only condition is given, return condition.nonzero().

Parameters:
  • condition (cupy.ndarray) – When True, take x, otherwise take y.
  • x (cupy.ndarray) – Values from which to choose on True.
  • y (cupy.ndarray) – Values from which to choose on False.
Returns:

Each element of output contains elements of x when

condition is True, otherwise elements of y. If only condition is given, return the tuple condition.nonzero(), the indices where condition is True.

Return type:

cupy.ndarray

See also

numpy.where()