Rate this Page

torch.foreach.clamp_max#

torch.foreach.clamp_max(inputs: TensorList, max: Scalar, /) tuple[Tensor, ...][source]#
torch.foreach.clamp_max(inputs: TensorList, max: ScalarList, /) tuple[Tensor, ...]
torch.foreach.clamp_max(inputs: TensorList, max: TensorList, /) tuple[Tensor, ...]

Applies torch.clamp() to every tensor in inputs.

This is semantically equivalent to applying torch.clamp() independently at every list position. Does not mutate its arguments and returns a tuple of result tensors.

Tensor-list arguments must be non-empty. Corresponding tensor or scalar lists must have the same length. An accelerated multi-tensor implementation is used only when supported by the inputs; otherwise the operation falls back to per-tensor execution.

Only the max bound is specified.

Parameters:
Returns:

a tuple containing one result tensor for each input tensor.