dpctl.tensor.clip

dpctl.tensor.clip(x, min=None, max=None, out=None, order='K')[source]

Clips to the range [min_i, max_i] for each element x_i in x.

Parameters:
  • x (usm_ndarray) – Array containing elements to clip. Must be compatible with min and max according to broadcasting rules.

  • min ({None, Union[usm_ndarray, bool, int, float, complex]}, optional) – Array containing minimum values. Must be compatible with x and max according to broadcasting rules.

  • max ({None, Union[usm_ndarray, bool, int, float, complex]}, optional) – Array containing maximum values. Must be compatible with x and min according to broadcasting rules.

  • out ({None, usm_ndarray}, optional) – Output array to populate. Array must have the correct shape and the expected data type.

  • order ("C","F","A","K", optional) – Memory layout of the newly output array, if parameter out is None. Default: “K”.

Returns:

An array with elements clipped to the range [min, max]. The returned array has the same data type as x.

Return type:

usm_ndarray