braindecode.modules.ResidualVectorQuantizer#
- class braindecode.modules.ResidualVectorQuantizer(dim, codebook_dim, codebook_size, num_quantizers, rotation_trick=True)[source]#
Residual vector quantisation with L2-normalisation.
Uses the EMA optimisation path with no quantize-dropout. Each residual stage is handled by a
VectorQuantizerlayer.- Parameters:
dim (
int) – Input feature dimensionality.codebook_dim (
int) – Internal dimensionality of eachVectorQuantizercodebook.codebook_size (
int) – Number of entries in each codebook.num_quantizers (
int) – Number of residual VQ stages stacked sequentially.rotation_trick (
bool) – Passed through to eachVectorQuantizerlayer.
Methods
- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.