Skip to main content

quiet_softmax

Function quiet_softmax 

pub fn quiet_softmax<const D: usize>(
    tensor: Tensor<D>,
    dim: impl AsIndex,
) -> Tensor<D>
Expand description

Applies the “quiet softmax” function on the input tensor along the given dimension.

Also referred to as softmax1.

This function is similar to the softmax function, but it allows for “no selection” when all the outputs are close to zero.

quiet_softmax(x_i) = exp(x_i) / [ 1 + sum_j(exp(x_j)) ]

§Arguments

  • dim: the dimension along which Quiet Softmax will be computed. Negative dimensions are supported and count from the end.

§Panics

  • If dim is outside [-D, D)