analogvnn.nn.activation.Tanh
#
Module Contents#
Classes#
Implements the tanh activation function. |
- class analogvnn.nn.activation.Tanh.Tanh[source]#
Bases:
analogvnn.nn.activation.Activation.Activation
Implements the tanh activation function.
- static forward(x: torch.Tensor) torch.Tensor [source]#
Forward pass of the tanh activation function.
- Parameters:
x (Tensor) – the input tensor.
- Returns:
the output tensor.
- Return type:
Tensor
- backward(grad_output: Optional[torch.Tensor]) Optional[torch.Tensor] [source]#
Backward pass of the tanh activation function.
- Parameters:
grad_output (Optional[Tensor]) – the gradient of the output tensor.
- Returns:
the gradient of the input tensor.
- Return type:
Optional[Tensor]
- static initialise(tensor: torch.Tensor) torch.Tensor [source]#
Initialisation of tensor using xavier uniform, gain associated with tanh.
- Parameters:
tensor (Tensor) – the tensor to be initialized.
- Returns:
the initialized tensor.
- Return type:
Tensor
- static initialise_(tensor: torch.Tensor) torch.Tensor [source]#
In-place initialisation of tensor using xavier uniform, gain associated with tanh.
- Parameters:
tensor (Tensor) – the tensor to be initialized.
- Returns:
the initialized tensor.
- Return type:
Tensor