Skip to main content

pool_span

Function pool_span 

Source
pub fn pool_span(
    hidden: &Tensor,
    offsets: &[(usize, usize)],
    span: &LabeledSpan,
) -> Result<Tensor>
Expand description

Pool one span from encoder hidden states: start ⊕ mean over the tokens overlapping the span, giving a 2H representation. Endpoint+mean is the standard span encoding; it keeps boundary information that a pure mean discards.