espnet2.gan_codec.hificodec.module.GroupResidualVectorQuantization
espnet2.gan_codec.hificodec.module.GroupResidualVectorQuantization
class espnet2.gan_codec.hificodec.module.GroupResidualVectorQuantization(quantizer_target_bandwidth, hidden_dim, quantizer_n_q, quantizer_bins, quantizer_decay, quantizer_kmeans_init, quantizer_kmeans_iters, quantizer_threshold_ema_dead_code, **kwargs)
Bases: Module
Initializes internal Module state, shared by both nn.Module and ScriptModule.
decode(code: Tensor)
HiFICodec codec decoding.
- Parameters:codes (torch.Tensor) – neural codecs in shape ().
- Returns: resynthesized audio.
- Return type: torch.Tensor
encode(xin: Tensor, frame_rate: int, target_bw: float | None = None)
HiFICodec codec encoding.
- Parameters:x (torch.Tensor) – Input tensor of shape (B, 1, T).
- Returns: neural codecs in shape ().
- Return type: torch.Tensor
forward(xin: Tensor, sample_rate: int, bandwidth: float | None = None) → QuantizedResult
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.