xnn.common.models.ops.make_activation#

xnn.common.models.ops.make_activation(activation)[source]#

Return a fresh activation module from a name or a module instance.

The one activation factory of the model families (the per-element networks of ANI / HDNNP, the voxel convolution networks of the cnn family).

Parameters:

activation (str or torch.nn.Module) – One of "silu", "celu" (ANI, alpha=0.1), "gaussian" (original ANI-1), "tanh", "relu", "sigmoid", "ssp" (the exact shifted softplus of SchNet / PhysNet), "softplus" (Softplus), "scaled_tanh" (ScaledTanh), "square" or "linear" (the identity); or an nn.Module used as-is.

Returns:

A fresh activation module.

Return type:

torch.nn.Module

Raises:

ValueError – If activation is an unknown name.