Skip to main content

l1_norm

Function l1_norm 

pub fn l1_norm<const D: usize, K>(
    x: Tensor<D, K>,
    dim: impl AsIndex,
) -> Tensor<D, K>
where K: Numeric,
Expand description

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

This is a convenience function that wraps vector_norm with p = 1.0.

§Arguments

  • x - The input tensor.
  • dim - The dimension to compute the norm over. Negative dimensions are supported and count from the end.

§Returns

The L1 norm of the input tensor.