pub(crate) fn insert_class_markers<M: ClassMarker>(
x: Tensor<3>,
markers: &[M],
emb: Option<&Param<Tensor<2>>>,
) -> (Tensor<3>, Vec<usize>)Expand description
Insert the learnable class tokens emb ([k, width], row i ↔ markers[i])
into x ([batch, orig_len, width]) per the markers, returning the
lengthened sequence ([batch, orig_len + k, width]) and, for each marker in
Vec order, its position in the output sequence.
markers empty ⇒ x is returned unchanged with an empty index vector.