xnn.common.models.ops.shifted_softplus#

xnn.common.models.ops.shifted_softplus(x)[source]#

Shifted softplus ssp(x) = ln(0.5 e^x + 0.5) with ssp(0) = 0.

The activation of SchNet (Schuett et al., NIPS 2017) and PhysNet (Unke & Meuwly 2019); smooth with infinite order of continuity, which is what keeps the predicted potential-energy surface (and thus the autograd forces) smooth.

Evaluated as max(x, 0) + log1p(exp(-|x|)) - ln 2 – exact for all x, unlike torch.nn.functional.softplus(), which switches to the identity above its threshold and drops the log1p(exp(-x)) tail (~1e-9 at the default threshold of 20). TorchScript-compatible.

Parameters:

x (torch.Tensor) – Input tensor of any shape.

Returns:

ln(0.5 e^x + 0.5), same shape as x.

Return type:

torch.Tensor