Skip to main content

prepend_cls

Function prepend_cls 

Source
pub fn prepend_cls(
    tokens: &[f32],
    cls: &[f32],
    embed_dim: usize,
) -> VisionResult<Vec<f32>>
Expand description

Prepend the CLS token to a [n_patches, embed_dim] token sequence.

Returns [(n_patches+1) * embed_dim] flat, with the CLS token at index 0.