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.
Parameters
Input; modified in place.
min_valfloat= -1.0Lower clamp bound. Default
-1.0.max_valfloat= 1.0Upper clamp bound. Default
1.0.inplacebool= TrueFalse returns hardtanh's fresh result instead.
Default True.Returns
TensorThe same x tensor, now clamped.