mlx.core.where

目录

mlx.core.where#

where(condition: scalar | array, x: scalar | array, y: scalar | array, /, *, stream: None | Stream | Device = None) array#

Select from x or y according to condition.

The condition and input arrays must be the same shape or broadcastable with each another.

参数:
  • condition (array) -- The condition array.

  • x (array) -- The input selected from where condition is True.

  • y (array) -- The input selected from where condition is False.

返回:

The output containing elements selected from x and y.

返回类型:

array