tf.norm

View source on GitHub

Computes the norm of vectors, matrices, and tensors.

tf.norm(
    tensor, ord='euclidean', axis=None, keepdims=None, name=None
)

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).

Args:

Returns:

Raises:

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.