flax.linen.activation.log_softmax#
- flax.linen.activation.log_softmax(x, axis=-1, where=None, initial=None)[source]#
Log-Softmax function.
Computes the logarithm of the
softmax
function, which rescales elements to the range \([-\infty, 0)\).\[\mathrm{log\_softmax}(x)_i = \log \left( \frac{\exp(x_i)}{\sum_j \exp(x_j)} \right)\]- Parameters
x – input array
axis – the axis or axes along which the
log_softmax
should be computed. Either an integer or a tuple of integers.where – Elements to include in the
log_softmax
.initial – The minimum value used to shift the input array. Must be present when
where
is not None.