Function quiet_softmax
pub fn quiet_softmax<const D: usize, B>(
tensor: Tensor<B, D>,
dim: usize,
) -> Tensor<B, D>where
B: Backend,
Expand description
Applies the “quiet softmax” function on the input tensor along the given dimension.
This function is similar to the softmax function, but it allows for “no selection” when all the outputs are close to zero.
$$ \text{quiet\_softmax}(x_i) = \frac{\exp(x_i)}{1 + \sum_j \exp(x_j)} $$
§Arguments
dim
: the dimension along which Softmax will be computed.
§Panics
- If
dim
is outside [0, D)