tensornn.activation.ELU

class tensornn.activation.ELU(a: float = 1)

Bases: Activation

Exponential linear unit is similar to ReLU, but it is not piecewise. Formula: A*((e^x)-1) | constants: A, e(Euler’s number, 2.718…)

Ex, A=1: [12.319, -91.3, 0.132] -> [12.319, -1, 0.132]

Methods

derivative

The derivative of the function.

forward

Calculate a forwards pass of this activation function.

source

__init__(a: float = 1) None

Initialize ELU.

Parameters:

a – multiplier used in formula, checkout help(tnn.activation.ELU), defaults to 1

__repr__() str

Return repr(self).

derivative(inputs: Tensor) Tensor

The derivative of the function. Used for backpropagation.

Parameters:

inputs – get the derivative of the function at this input

Returns:

the derivative of the function at the given input

forward(inputs: Tensor) Tensor

Calculate a forwards pass of this activation function.

Parameters:

inputs – the outputs from the previous layer

Returns:

the inputs after they are passed through the activation function