ivy.norm(x, ord=2, axis=- 1, keepdims=False, f=None)[source]

Matrix or vector norm. This function is able to return ord-1 and ord-2 vector-norms and matrix-norms.

  • x (array) – Input array. If axis is None, x must be 1-D or 2-D.

  • ord (int) – Order of the norm.

  • axis ({int, 2-sequence of ints}, optional) – If axis is an integer, it specifies the axis of x along which to compute the vector norms. If axis is a 2-tuple, it specifies the axes that hold 2-D matrices, and the matrix norms of these matrices are computed.

  • keepdims (bool, optional) – If this is set to True, the axes which are normed over are left in the result as dimensions with size one. With this option the result will broadcast correctly against the original x. Default is False.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.


Norm of the matrix or vector(s).

Supported Frameworks:

empty jax_logo empty tf_logo empty pytorch_logo empty mxnet_logo empty numpy_logo empty