torch.foreach.norm#
- torch.foreach.norm(inputs: TensorList, /, *, ord: Scalar = 2, dtype: dtype | None = None) tuple[Tensor, ...][source]#
Returns the vector norm of each tensor in
inputs.This is semantically equivalent to applying
torch.linalg.vector_norm()independently at every list position. Does not mutate its arguments and returns a tuple of result tensors.Tensor-list arguments must be non-empty. An accelerated multi-tensor implementation is used only when supported by the inputs; otherwise the operation falls back to per-tensor execution.
Every input tensor is reduced over all dimensions. The
dimandkeepdimoptions oftorch.linalg.vector_norm()are not supported.- Parameters:
ord (Number, optional) – norm order. Default:
2.dtype (
torch.dtype, optional) – dtype used for the computation.
- Returns:
a tuple containing one norm tensor per input tensor.