oa::ResidualVectorQuantizer
ResidualVectorQuantizer class in the OA Ml public surface.
Inheritance
public Module
Public Methods
Constructor & Destructor Documentation
No public source comment is attached to this declaration.
Parameters
inConfigconst VectorQuantizerConfig &—
inNumLevelsoa::I32—
No public source comment is attached to this declaration.
Public Method Documentation
Per-level EMA codebook update; call once per step AFTER the optimizer step with the result returned by this step's quantize().
Parameters
inResultconst ResidualVqResult &—
Returns
voidThe declared return value.
No public source comment is attached to this declaration.
Parameters
inZeconst oa::Matrix &—
Returns
oa::MatrixThe declared return value.
No public source comment is attached to this declaration.
Parameters
qoa::I32—
Returns
VectorQuantizer &The declared return value.
Token → latent: sum each level's gathered code vectors. The inference-time inverse of quantize for the SUMMED RVQ output — pass per-level generated token ids (one [N] Int32 per level, shallow→deep) → z_q [N, D] for the decoder. inIdx may carry fewer than numLevels() levels (e.g. a model that only generates level 0); only the supplied levels are summed.
Parameters
inIdxconst oa::Vector<oa::Matrix> &—
Returns
oa::MatrixThe declared return value.
No public source comment is attached to this declaration.
Returns
oa::I32The declared return value.
z_e [N, D] → straight-through total quantization + per-level tokens + per-level residuals (kept for emaUpdate) + commitment loss. Records entirely on-GPU.
Parameters
inZeconst oa::Matrix &—
Returns
ResidualVqResultThe declared return value.
Greedy data-dependent seed: seed level 0 from the latents, then each deeper level from the running residual under the already-seeded shallower levels.
Parameters
inLatentsconst oa::Matrix &—
Returns
voidThe declared return value.