Skip to main content

sub_exp_slice_dispatch

Function sub_exp_slice_dispatch 

Source
pub fn sub_exp_slice_dispatch(input: &[f32], offset: f32, output: &mut [f32])
Expand description

Fused subtract-and-exp: output[i] = exp(input[i] - offset).

Combines the max-subtraction and exp steps of softmax into one pass, avoiding an extra read/write of the output buffer.