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