espnet2.tts.feats_extract.yin.cumulativeMeanNormalizedDifferenceFunctionTorch
espnet2.tts.feats_extract.yin.cumulativeMeanNormalizedDifferenceFunctionTorch
espnet2.tts.feats_extract.yin.cumulativeMeanNormalizedDifferenceFunctionTorch(dfs: Tensor, N, eps=1e-08) → Tensor
Compute cumulative mean normalized difference function (CMND) using PyTorch.
This function computes the cumulative mean normalized difference function (CMND) based on the provided difference function. The computation is performed in a batch-wise manner and is designed to handle tensors efficiently. This corresponds to equation (8) in the referenced literature.
espnet2.tts.feats_extract.yin.dfs
The input difference function tensor of shape (B, N), where B is the batch size and N is the length of the difference function.
Type: torch.Tensor
Parameters:
- dfs (torch.Tensor) – A tensor representing the difference function.
- N (int) – The length of the data used in the computation.
- eps (float , optional) – A small value added for numerical stability. Defaults to 1e-8.
Returns: A tensor representing the cumulative mean normalized difference function of shape (B, N).
Return type: torch.Tensor
Examples
>>> dfs = torch.tensor([[0.0, 1.0, 2.0], [0.0, 1.5, 2.5]])
>>> cmndf = cumulativeMeanNormalizedDifferenceFunctionTorch(dfs, 3)
>>> print(cmndf)
tensor([[1.0000, 1.0000, 1.0000],
[1.0000, 1.0000, 1.0000]])
NOTE
This function assumes that the input difference function dfs has at least two columns, as it computes cumulative sums starting from the second column.