where

ivy.where(condition: ivy.NativeArray, x1: ivy.NativeArray, x2: ivy.NativeArray, f: Optional[ivy.Framework] = None) → ivy.NativeArray[source]

Returns elements chosen from x or y depending on condition.

Parameters
  • condition (bool array) – Where True, yield x1, otherwise yield x2.

  • x1 (array) – values from which to choose when condition is True.

  • x2 (array) – values from which to choose when condition is False.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

An array with elements from x1 where condition is True, and elements from x2 elsewhere.


Supported Frameworks:

empty jax_logo empty tf_logo empty pytorch_logo empty mxnet_logo empty numpy_logo empty