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 (
Union
[Array
,ndarray
,bool_
,number
,bool
,int
,float
,complex
]) – input arrayaxis (
Union
[int
,tuple
[int
,...
],None
]) – the axis or axes along which thelog_softmax
should be computed. Either an integer or a tuple of integers.where (
Union
[Array
,ndarray
,bool_
,number
,bool
,int
,float
,complex
,None
]) – Elements to include in thelog_softmax
.initial (
Union
[Array
,ndarray
,bool_
,number
,bool
,int
,float
,complex
,None
]) – The minimum value used to shift the input array. Must be present whenwhere
is not None.
- Return type:
- Returns:
An array.
See also