Expand description
Learnable [CLS]-style class tokens/latents spliced into the sequence.
Macrosยง
- impl_
class_ ๐marker
Enumsยง
- Class
Latent - Position marker for a learnable class latent inserted into a layerโs
working sequence (embedding width =
d_model). - Class
Latent ๐Serde - Class
Token - Position marker for a learnable class token inserted into a networkโs input sequence (embedding width = the network input width / โd_inputโ).
- Class
Token ๐Serde
Traitsยง
- Class
Marker - Shared behaviour of the
ClassToken/ClassLatentposition markers, letting one generic helper place either kind.
Functionsยง
- assert_
step_ ๐compatible - Panic if any marker is incompatible with single-token
step(). - class_
marker_ ๐output_ indices - The output-sequence position of each marker (in
Vecorder) for an input of lengthorig_len, without materialising any tensor. Mirrors the placement ininsert_class_markersโ useful for reading a class token back out. - class_
step_ ๐injections - The output-sequence position of each step-injectable marker (in
Vecorder), for use bystepโs cursor. Asserts noMiddle/End(those need the full length โforwardonly).Start/Custompositions are length-independent, so an unboundedorig_lenresolves them exactly. - init_
class_ ๐emb - Build the embedding param for
nclass markers of the givenwidth(Nonewhen there are none โ Burn has no zero-width tensors). - insert_
class_ ๐markers - Insert the learnable class tokens
emb([k, width], rowiโmarkers[i]) intox([batch, orig_len, width]) per themarkers, returning the lengthened sequence ([batch, orig_len + k, width]) and, for each marker inVecorder, its position in the output sequence.