mlx.core.subtract#

mlx.core.subtract(a: Union[scalar, array], b: Union[scalar, array], stream: Union[None, Stream, Device] = None) array#

Element-wise subtraction.

Subtract one array from another with numpy-style broadcasting semantics. Either or both input arrays can also be scalars.

Parameters:
  • a (array) – Input array or scalar.

  • b (array) – Input array or scalar.

Returns:

The difference a - b.

Return type:

array