Continuously differentiable Exponential Linear Unit (CELU)#

API#

class warp_nn.modules.activations.CELU(*, alpha: float = 1.0, requires_grad: bool = True)[source]#

Bases: Module

Continuously differentiable Exponential Linear Unit (CELU) activation function.

This class computes the element-wise CELU activation function:

\[\text{CELU}(x) = \max(0, x) + \min\left(0, \alpha \, (e^{x / \alpha} - 1)\right)\]
Parameters:
  • alpha – The alpha value for the CELU function. It must be non-zero.

  • requires_grad – Whether the cached output arrays of the module require gradients.

Raises:

ValueError – If alpha is zero.

__call__(input: array) → array[source]#

Forward pass of the activation function.

Parameters:

input – The input array, with up to 3 dimensions.

Returns:

The output array, with same shape as the input array.

Raises:

TypeError – If the input array’s data type or number of dimensions is not supported.

property alpha: float[source]#

The alpha value for the CELU function.