mlx.core.divmod#

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

Element-wise quotient and remainder.

The fuction divmod(a, b) is equivalent to but faster than (a // b, a % b). The function uses 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 quotient a // b and remainder a % b.

Return type:

tuple(array, array)