hardtanh_(x: Tensor, min_val: float = -1.0, max_val: float = 1.0, inplace: bool = True)In-place hardtanh — clamps x to [min_val, max_val] in place.
Equivalent to x.clamp_(min_val, max_val) but kept under the
nn.functional name for activation-API symmetry.
Parameters
Input; modified in place.
min_valfloat= -1.0Lower clamp bound. Default
-1.0.max_valfloat= 1.0Upper clamp bound. Default
1.0.inplacebool= TrueIgnored. Default
True.Returns
TensorThe same x tensor, now clamped.