cdist#
- class diffsptk.CepstralDistance(full=False, reduction='mean')[source]#
See this page for details.
- Parameters:
- fullbool
If True, include the constant term in the distance calculation.
- reduction[‘none’, ‘mean’, ‘batchmean’, ‘sum’]
Reduction type.
References
[1]R. F. Kubichek, “Mel-cepstral distance measure for objective speech quality assessment,” Proceedings of IEEE Pacific Rim Conference on Communications Computers and Signal Processing, vol. 1, pp. 125-128, 1993.
- forward(c1, c2)[source]#
Calculate cepstral distance between two inputs.
- Parameters:
- c1Tensor [shape=(…, M+1)]
Input cepstral coefficients.
- c2Tensor [shape=(…, M+1)]
Target cepstral coefficients.
- Returns:
- outTensor [shape=(…,) or scalar]
Cepstral distance.
Examples
>>> c1 = diffsptk.nrand(2, 2) tensor([[ 0.4296, 1.6517, -0.6022], [-1.0464, -0.6088, -0.9274]]) >>> c2 = diffsptk.nrand(2, 2) tensor([[ 1.6441, -0.6962, -0.2524], [ 0.9344, 0.3965, 1.1494]]) >>> cdist = diffsptk.CepstralDistance() >>> distance = cdist(c1, c2) >>> distance tensor(1.6551)
- diffsptk.functional.cdist(c1, c2, full=False, reduction='mean')[source]#
Calculate cepstral distance between two inputs.
- Parameters:
- c1Tensor [shape=(…, M+1)]
Input cepstral coefficients.
- c2Tensor [shape=(…, M+1)]
Target cepstral coefficients.
- fullbool
If True, include the constant term in the distance calculation.
- reduction[‘none’, ‘mean’, ‘batchmean’, ‘sum’]
Reduction type.
- Returns:
- outTensor [shape=(…,) or scalar]
Cepstral distance.
See also