clip_vector_norm

ivy.clip_vector_norm(x: Union[ivy.Array, ivy.NativeArray], max_norm: float, p: float = 2.0) → Union[ivy.Array, ivy.NativeArray][source]

Clips (limits) the vector p-norm of an array.

Parameters
  • x (array) – Input array containing elements to clip.

  • max_norm (float) – The maximum value of the array norm.

  • p (float, optional) – The p-value for computing the p-norm. Default is 2.

Returns

An array with the vector norm downscaled to the max norm if needed.


Supported Frameworks:

empty jax_logo empty tf_logo empty pytorch_logo empty mxnet_logo empty numpy_logo empty