Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TorchScript test for F.phase_vocoder #1379

Merged
merged 2 commits into from
Mar 10, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Test suites for jit-ability and its numerical compatibility"""
import unittest
import numpy as np

import torch
import torchaudio.functional as F
Expand Down Expand Up @@ -547,6 +548,20 @@ def func(tensor):
tensor = common_utils.get_whitenoise(sample_rate=44100)
self._assert_consistency(func, tensor)

def test_phase_vocoder(self):
def func(tensor):
rate = 0.5
hop_length = 256
phase_advance = torch.linspace(
PengfeiWangWZ marked this conversation as resolved.
Show resolved Hide resolved
0,
np.pi * hop_length,
PengfeiWangWZ marked this conversation as resolved.
Show resolved Hide resolved
tensor.shape[-3],
dtype=torch.float64)[..., None]
return F.phase_vocoder(tensor, rate, phase_advance)

tensor = torch.randn(2, 1025, 400, 2)
self._assert_consistency(func, tensor)

@common_utils.skipIfNoKaldi
def test_compute_kaldi_pitch(self):
if self.dtype != torch.float32 or self.device != torch.device('cpu'):
Expand Down