dequantize#
- class diffsptk.InverseUniformQuantization(abs_max: float = 1, n_bit: int = 8, quantizer: str | int = 'mid-rise')[source]#
See this page for details.
- Parameters:
- abs_maxfloat > 0
The absolute maximum value of the original waveform.
- n_bitint >= 1
The number of quantization bits.
- quantizer[‘mid-rise’, ‘mid-tread’]
The quantizer type.
- forward(y: Tensor) Tensor [source]#
Dequantize the input waveform.
- Parameters:
- yTensor [shape=(…,)]
The quantized waveform.
- Returns:
- outTensor [shape=(…,)]
The dequantized waveform.
Examples
>>> x = diffsptk.ramp(-4, 4) >>> x tensor([-4., -3., -2., -1., 0., 1., 2., 3., 4.]) >>> quantize = diffsptk.UniformQuantization(4, 2) >>> dequantize = diffsptk.InverseUniformQuantization(4, 2) >>> x2 = dequantize(quantize(x)) >>> x2 tensor([-3., -3., -1., -1., 1., 1., 3., 3., 3.])
- diffsptk.functional.dequantize(y: Tensor, abs_max: float = 1, n_bit: int = 8, quantizer: str = 'mid-rise') Tensor [source]#
Dequantize the input waveform.
- Parameters:
- yTensor [shape=(…,)]
The quantized waveform.
- abs_maxfloat > 0
The absolute maximum value of the original waveform.
- n_bitint >= 1
The number of quantization bits.
- quantizer[‘mid-rise’, ‘mid-tread’]
The quantizer type.
- Returns:
- outTensor [shape=(…,)]
The dequantized waveform.