mlx.core.clip

目录

mlx.core.clip#

clip(a: array, /, a_min: scalar | array | None, a_max: scalar | array | None, *, stream: None | Stream | Device = None) array#

Clip the values of the array between the given minimum and maximum.

If either a_min or a_max are None, then corresponding edge is ignored. At least one of a_min and a_max cannot be None. The input a and the limits must broadcast with one another.

参数:
  • a (array) -- Input array.

  • a_min (scalar or array or None) -- Minimum value to clip to.

  • a_max (scalar or array or None) -- Maximum value to clip to.

返回:

The clipped array.

返回类型:

array