{ }
View source on GitHub |
Computes the norm of vectors, matrices, and tensors.
tf.norm(
tensor, ord='euclidean', axis=None, keepdims=None, name=None
)
Used in the notebooks
Used in the guide | Used in the tutorials |
---|---|
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).
Raises | |
---|---|
ValueError
|
If ord or axis is invalid.
|
numpy compatibility
Mostly equivalent to numpy.linalg.norm.
Not supported: ord <= 0, 2-norm for matrices, nuclear norm.
Other differences:
a) If axis is None
, treats the flattened tensor
as a vector
regardless of rank.
b) Explicitly supports 'euclidean' norm as the default, including for
higher order tensors.