Function vector_norm

pub fn vector_norm<B, const D: usize>(
    x: Tensor<B, D>,
    norm: impl Into<Norm>,
    dim: usize,
) -> Tensor<B, D>
where B: Backend,
Expand description

Computes the vector norm of a tensor along a specified dimension.

Generic dispatch wrapper over specialized / optimized norms.

See:

  • https://pytorch.org/docs/stable/generated/torch.linalg.vector_norm.html
  • https://numpy.org/doc/stable/reference/generated/numpy.linalg.vector_norm.html

§Arguments

  • x - The input tensor.
  • norm - The selected norm.
  • dim - The dimension to compute the norm over.

§Returns

The vector norm of the input tensor.