Skip to main content

l2_norm_dims

Function l2_norm_dims 

pub fn l2_norm_dims<const D: usize, I>(x: Tensor<D>, dims: &[I]) -> Tensor<D>
where I: AsIndex,
Expand description

Computes the L2 norm of a tensor along specified dimensions.

If dims is empty, no dimensions are reduced, matching ONNX noop_with_empty_axes=true semantics (the norm transformation is applied elementwise without collapsing axes).

§Arguments

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

§Returns

The L2 norm of the input tensor.