Function lp_norm
pub fn lp_norm<const D: usize>(
x: Tensor<D>,
p: f64,
dim: impl AsIndex,
) -> Tensor<D>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. Negative dimensions are supported and count from the end.
§Returns
The L(p) norm of the input tensor.