Function log_softmax
pub fn log_softmax<const D: usize, B>(
tensor: Tensor<B, D>,
dim: usize,
) -> Tensor<B, D>where
B: Backend,
Expand description
Applies the log softmax function on the input tensor along the given dimension.
$$ \text{log\_softmax}(x_i) = \log\left(\text{softmax}(x_i)\right) = \log\left(\frac{\exp(x_i)}{\sum_j \exp(x_j)}\right) $$
§Arguments
dim
: the dimension along which Softmax will be computed.
§Panics
- If
dim
is outside [0, D)