Log-Softmax#
API#
- class warp_nn.modules.activations.LogSoftmax(*, dim: int = -1, requires_grad: bool = True)[source]#
Log-Softmax activation function.
This class computes the logarithm of the Softmax activation function along the given dimension:
\[\text{LogSoftmax}(x_i) = \log\left(\frac{e^{x_i}}{\sum_j e^{x_j}}\right) = x_i - \log\left(\sum_j e^{x_j}\right)\]- Parameters:
dim – The dimension along which the Log-Softmax function is computed.
requires_grad – Whether the cached output arrays of the module require gradients.
- __call__(
- input: array,
Forward pass of the activation function.
- Parameters:
input – The input array.
- Returns:
The output array, with same shape as the input array.
- Raises:
IndexError – If the dimension is out of range for the input array.
TypeError – If the input array’s data type is not supported.