Skip to content
fn

threshold_

→Tensor
threshold_(input: Tensor, threshold: float, value: float, inplace: bool = True)

In-place threshold — replace entries <= threshold with value.

Parameters

inputTensor
Input; modified in place.
thresholdfloat
Cutoff; positions where input <= threshold are reset.
valuefloat
Replacement value for clipped positions.
inplacebool= True
False returns threshold's fresh result instead. Default True.

Returns

Tensor

The same input tensor, with sub-threshold positions set to value and the rest unchanged.

Used by 1