imsvq#

class diffsptk.InverseMultiStageVectorQuantization[source]#

See this page for details.

forward(indices, codebooks)[source]#

Perform inverse residual vector quantization.

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

Codebook indices.

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

Codebooks.

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

Quantized vectors.

Examples

>>> msvq = diffsptk.MultiStageVectorQuantization(4, 3, 2)
>>> imsvq = diffsptk.InverseMultiStageVectorQuantization()
>>> indices = torch.tensor([[0, 1], [1, 0]])
>>> xq = imsvq(indices, msvq.codebooks)
>>> xq
tensor([[-0.8029, -0.1674,  0.5697,  0.9734,  0.1920],
        [ 0.0720, -1.0491, -0.4491, -0.2043, -0.3582]])

See also

ivq msvq