xnn.common.models.ops.exact_softplus#
- xnn.common.models.ops.exact_softplus(x)[source]#
Evaluate
log(1 + exp(x))exactly to round-off, with exact derivatives.One fused
torch.nn.functional.softplus()kernel per pass in eager mode (two selections aroundlog1p(exp(-|x|))under TorchScript). The fused kernel returnsxabove its threshold and so drops the taillog(1 + exp(-x)), which is below the rounding of the value and of the derivativesigmoid(x)onceexp(-threshold)is: a threshold of 40 in float64 (exp(-40) = 4e-18) and 20 otherwise (exp(-20) = 2e-9), against the default 20 that drops2e-9in float64.- Parameters:
x (Tensor) – Input values of any shape.
- Returns:
Softplus values with the same shape as
x.- Return type:
Tensor