xnn.common.models.ops.Softplus#

class xnn.common.models.ops.Softplus(*args, **kwargs)[source]#

Bases: Module

Softplus log(1 + e^x) evaluated exactly at every x, as max(x, 0) + log1p(e^-|x|).

torch.nn.Softplus switches to x above its threshold and drops the log1p tail; this one keeps it (the softplus of the HDNNP networks).

forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Parameters:

x (Tensor)

Return type:

Tensor