espnet2.gan_codec.shared.quantizer.modules.core_vq.ResidualVectorQuantization
espnet2.gan_codec.shared.quantizer.modules.core_vq.ResidualVectorQuantization
class espnet2.gan_codec.shared.quantizer.modules.core_vq.ResidualVectorQuantization(*, num_quantizers, **kwargs)
Bases: Module
Residual vector quantization implementation.
Follows Algorithm 1. in https://arxiv.org/pdf/2107.03312.pdf
Initializes internal Module state, shared by both nn.Module and ScriptModule.
decode(q_indices: Tensor) → Tensor
encode(x: Tensor, n_q: int | None = None, st: int | None = None) → Tensor
forward(x, n_q: int | None = None)
Defines 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 Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.