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)withssp(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 allx, unliketorch.nn.functional.softplus(), which switches to the identity above its threshold and drops thelog1p(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 asx.- Return type: