Computes the norm of vectors, matrices, and tensors.
tensor, ord='euclidean', axis=None, keepdims=None, name=None
Used in the notebooks
This function can compute several different vector norms (the 1-norm, the
Euclidean or 2-norm, the inf-norm, and in general the p-norm for p > 0) and
matrix norms (Frobenius, 1-norm, 2-norm and inf-norm).
Tensor of types
Order of the norm. Supported values are
np.inf and any positive real number yielding the corresponding
p-norm. Default is
'euclidean' which is equivalent to Frobenius norm if
tensor is a matrix and equivalent to 2-norm for vectors.
Some restrictions apply:
a) The Frobenius norm
'fro' is not defined for vectors,
b) If axis is a 2-tuple (matrix norm), only
np.inf are supported.
See the description of
axis on how to compute norms for a batch of
vectors or matrices stored in a tensor.
None (the default), the input is considered a vector
and a single vector norm is computed over the entire set of values in the
norm(tensor, ord=ord) is equivalent to
norm(reshape(tensor, [-1]), ord=ord).
axis is a Python integer, the input is considered a batch of vectors,
axis determines the axis in
tensor over which to compute vector
axis is a 2-tuple of Python integers it is considered a batch of
axis determines the axes in
tensor over which to compute
a matrix norm.