Skip to main content

embedding

Function embedding 

Source
pub fn embedding(
    ids: &Tensor,
    wte: &Tensor,
    wpe: Option<&Tensor>,
    pos: usize,
) -> Result<Tensor>
Expand description

Fused token + positional embedding: out[t] = wte[ids[t]] + wpe[t + pos].