ivq#

class diffsptk.InverseVectorQuantization[source]#

See this page for details.

forward(indices, codebook)[source]#

Perform inverse vector quantization.

Parameters:
indicesTensor [shape=(…,)]

Codebook indices.

codebookTensor [shape=(K, M+1)]

Codebook.

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

Quantized vectors.

Examples

>>> vq = diffsptk.VectorQuantization(4, 2)
>>> ivq = diffsptk.InverseVectorQuantization()
>>> indices = torch.tensor([[0, 1], [1, 0]])
>>> xq = ivq(indices, vq.codebook)
>>> xq
tensor([[[ 1.9246, -1.4498, -0.9959,  0.3809,  0.0478],
         [-0.3040,  0.0568,  0.0113, -0.7284, -0.5103]],
        [[-0.3040,  0.0568,  0.0113, -0.7284, -0.5103],
         [ 1.9246, -1.4498, -0.9959,  0.3809,  0.0478]]])

See also

vq lbg