espnet2.gan_codec.shared.quantizer.residual_vq.QuantizedResult
Less than 1 minute
espnet2.gan_codec.shared.quantizer.residual_vq.QuantizedResult
class espnet2.gan_codec.shared.quantizer.residual_vq.QuantizedResult(quantized: Tensor, codes: Tensor, bandwidth: Tensor, penalty: Tensor | None = None)
Bases: object
Represents the result of quantization from a residual vector quantizer.
quantized
The quantized representation of the input tensor.
- Type: torch.Tensor
codes
The codes representing the quantized values.
- Type: torch.Tensor
bandwidth
Bandwidth in kb/s used, per batch item.
- Type: torch.Tensor
penalty
Optional penalty term for the loss, if applicable.
- Type: Optional[torch.Tensor]
Examples
>>> result = QuantizedResult(
... quantized=torch.tensor([[0.1, 0.2], [0.3, 0.4]]),
... codes=torch.tensor([[1, 2], [3, 4]]),
... bandwidth=torch.tensor([128.0]),
... penalty=torch.tensor([0.05])
... )
>>> print(result.quantized)
tensor([[0.1, 0.2],
[0.3, 0.4]])
>>> print(result.codes)
tensor([[1, 2],
[3, 4]])
>>> print(result.bandwidth)
tensor([128.])
>>> print(result.penalty)
tensor([0.05])
bandwidth
codes
penalty
quantized