pub fn pool(
hidden: &[f32],
n_embd: usize,
ty: PoolingType,
) -> Result<Vec<f32>, PoolingError>Expand description
Pools hidden (n_tokens rows of n_embd floats, in row order)
down to one vector — except for PoolingType::None, which returns
every row unchanged.
No L2 normalization happens here, because none happens in
build_pooling either: upstream normalizes in the caller
(common_embd_normalize, chosen by llama-embedding --embd-normalize
and by the server’s /v1/embeddings), and folding it in here would
make MEAN and CLS silently return something the graph did not.