Function softplus_with_threshold
pub fn softplus_with_threshold<const D: usize>(
tensor: Tensor<D>,
beta: f64,
threshold: f64,
) -> Tensor<D>Expand description
Applies the SoftPlus function element-wise, with an explicit stability threshold.
See softplus for the function itself, which uses the default threshold of 20.0.
For values where beta * x > threshold, returns x directly to avoid overflow when
evaluating the exponential. A threshold beyond the dtype’s finite exp range is lowered to
the largest safe value.
§Arguments
beta: Controls the sharpness of the approximation to ReLU.threshold: The value ofbeta * xabove which the linear approximation is used.