Skip to main content

SoftmaxExp

Trait SoftmaxExp 

Source
pub trait SoftmaxExp: Scalar {
    // Required method
    fn softmax_exp(self) -> Self;
}
Expand description

exp(x) for the softmax’s shifted logits, x <= 0 (C++ detail::HeadExp).

For the Q formats it is the 96-entry exp lookup table, which spans [-6, 6] and clamps below. A class 6 or more behind the largest logit would then keep e^-6 ~ 0.0025 of the probability, the softmax would never reach a one-hot and the logits of a well separated head would grow until the format wraps; at or below -6 the true value is under 0.0025, so it is taken as 0. For f32 and f64 it is the math library’s exp (feature std or libm).

Required Methods§

Source

fn softmax_exp(self) -> Self

exp(self) for self <= 0.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl SoftmaxExp for f32

Available on crate feature std only.
Source§

fn softmax_exp(self) -> Self

Source§

impl SoftmaxExp for f64

Available on crate feature std only.
Source§

fn softmax_exp(self) -> Self

Implementors§