Skip to main content

compute_logistic

Function compute_logistic 

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

Compute the elementwise logistic (sigmoid) output = 1 / (1 + exp(-input)) over equal-length contiguous f32 slices using MLAS’s SIMD sigmoid. Single threaded; callers shard across threads themselves when needed.

This is the vectorized primitive behind SiLU (x * sigmoid(x)), replacing a scalar expf loop that LLVM cannot autovectorize.