TensorDictBase.clamp#
- TensorDictBase.clamp(min: TensorDictBase | Tensor | float | None = None, max: TensorDictBase | Tensor | float | None = None, *, out=None) Self#
Clamps all elements in
selfinto the range [min,max].Letting min_value and max_value be
minandmax, respectively, this returns:Note
If
minis greater thanmaxtorch.clamp(..., min, max)sets all elements ininputto the value ofmax.
Every tensordict class and every tensorclass has this method. For the other methods, see Methods by task.