numpy.linalg.vector_norm#

linalg.vector_norm(x, /, *, axis=None, keepdims=False, ord=2)[source]#

Computes the vector norm of a vector (or batch of vectors) x.

This function is Array API compatible.

Parameters:
xarray_like

Input array.

axis{None, int, 2-tuple of ints}, optional

If an integer, axis specifies the axis (dimension) along which to compute vector norms. If an n-tuple, axis specifies the axes (dimensions) along which to compute batched vector norms. If None, the vector norm must be computed over all array values (i.e., equivalent to computing the vector norm of a flattened array). Default: None.

keepdimsbool, optional

If this is set to True, the axes which are normed over are left in the result as dimensions with size one. Default: False.

ord{1, -1, 2, -2, inf, -inf, ‘fro’, ‘nuc’}, optional

The order of the norm. For details see the table under Notes in numpy.linalg.norm.

See also

numpy.linalg.norm

Generic norm function