braindecode.modules.SafeLog#

class braindecode.modules.SafeLog(epsilon: float = 1e-06)[source]#

Safe logarithm activation function module.

:math:text{SafeLog}(x) = logleft(max(x, epsilon)right)

Parameters:

eps (float, optional) – A small value to clamp the input tensor to prevent computing log(0) or log of negative numbers. Default is 1e-6.

Methods

extra_repr() str[source]#

Return the extra representation of the module.

To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.

forward(x) Tensor[source]#

Forward pass of the SafeLog module.

Parameters:

x (torch.Tensor) – Input tensor.

Returns:

Output tensor after applying safe logarithm.

Return type:

torch.Tensor