analogvnn.nn.activation.Identity#

Module Contents#

Classes#

Identity

Implements the identity activation function.

class analogvnn.nn.activation.Identity.Identity(name=None)[source]#

Bases: analogvnn.nn.activation.Activation.Activation

Implements the identity activation function.

Variables:

name (str) – the name of the activation function.

name: Optional[str][source]#
extra_repr() str[source]#

Extra __repr__ of the identity activation function.

Returns:

the extra representation of the identity activation function.

Return type:

str

static forward(x: torch.Tensor) torch.Tensor[source]#

Forward pass of the identity activation function.

Parameters:

x (Tensor) – the input tensor.

Returns:

the output tensor same as the input tensor.

Return type:

Tensor

backward(grad_output: Optional[torch.Tensor]) Optional[torch.Tensor][source]#

Backward pass of the identity activation function.

Parameters:

grad_output (Optional[Tensor]) – the gradient of the output tensor.

Returns:

the gradient of the input tensor same as the gradient of the output tensor.

Return type:

Optional[Tensor]