lp_norm

Function lp_norm 

pub fn lp_norm<B, const D: usize>(
    x: Tensor<B, D>,
    p: f64,
    dim: usize,
) -> Tensor<B, D>
where B: Backend,
Expand description

Computes the general L(p) norm of a tensor along a specified dimension.

Uses the specialized implementations for:

  • 0.0
  • 1.0
  • 2.0
  • 2 * N for integral N,
  • f64::INFINITY,
  • f64::NEG_INFINITY,

§Arguments

  • x - The input tensor.
  • p - The exponent of the Lp norm.
  • dim - The dimension to compute the norm over.

§Returns

The L(p) norm of the input tensor.