cdist¶
- class diffsptk.CepstralDistance(full=False, reduction='mean')[source]¶
See this page for details.
- Parameters
- fullbool [scalar]
If true, include the constant term in the distance calculation.
- reduction[‘none’, ‘mean’, ‘batchmean’, ‘sum’]
Reduction type.
- 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
- distTensor [shape=(…,) or scalar]
Cepstral distance.
Examples
>>> c1 = torch.randn(2, 3) tensor([[ 0.4296, 1.6517, -0.6022], [-1.0464, -0.6088, -0.9274]]) >>> c2 = torch.randn(2, 3) tensor([[ 1.6441, -0.6962, -0.2524], [ 0.9344, 0.3965, 1.1494]]) >>> cdist = diffsptk.CepstralDistance() >>> dist = cdist(c1,c2) >>> dist tensor(1.6551)
See also