imsvq#

class diffsptk.InverseMultiStageVectorQuantization[source]#

See this page for details.

References

[1]

A. v. d. Oord et al., “Neural discrete representation learning,” Advances in Neural Information Processing Systems, pp. 6309-6318, 2017.

forward(indices: Tensor, codebooks: Tensor) Tensor[source]#

Perform inverse residual vector quantization.

Parameters:
indicesTensor [shape=(…, Q)]

The codebook indices.

codebooksTensor [shape=(Q, K, M+1)]

The codebooks.

Returns:
xqTensor [shape=(…, M+1)]

The quantized vectors.

Examples

>>> import diffsptk
>>> msvq = diffsptk.MultiStageVectorQuantization(4, 3, n_stage=2)
>>> imsvq = diffsptk.InverseMultiStageVectorQuantization()
>>> indices = torch.tensor([[0, 1], [2, 1]])
>>> xq = imsvq(indices, msvq.codebooks)
>>> xq.shape
torch.Size([2, 5])

See also

ivq msvq