(
n_fft,
win_length,
hop_length,
window,
center,
normalized,
onesided,
spec_transform_type,
)
| 20 | @pytest.mark.parametrize("onesided", [True, False]) |
| 21 | @pytest.mark.parametrize("spec_transform_type", ["none", "exponent", "log"]) |
| 22 | def test_STFTDecoder_backward( |
| 23 | n_fft, |
| 24 | win_length, |
| 25 | hop_length, |
| 26 | window, |
| 27 | center, |
| 28 | normalized, |
| 29 | onesided, |
| 30 | spec_transform_type, |
| 31 | ): |
| 32 | decoder = STFTDecoder( |
| 33 | n_fft=n_fft, |
| 34 | win_length=win_length, |
| 35 | hop_length=hop_length, |
| 36 | window=window, |
| 37 | center=center, |
| 38 | normalized=normalized, |
| 39 | onesided=onesided, |
| 40 | spec_transform_type=spec_transform_type, |
| 41 | ) |
| 42 | |
| 43 | real = torch.rand(2, 300, n_fft // 2 + 1 if onesided else n_fft, requires_grad=True) |
| 44 | imag = torch.rand(2, 300, n_fft // 2 + 1 if onesided else n_fft, requires_grad=True) |
| 45 | x = ComplexTensor(real, imag) |
| 46 | x_lens = torch.tensor([300 * hop_length, 295 * hop_length], dtype=torch.long) |
| 47 | y, ilens = decoder(x, x_lens) |
| 48 | y.sum().backward() |
| 49 | |
| 50 | |
| 51 | @pytest.mark.parametrize("n_fft", [512]) |
nothing calls this directly
no test coverage detected
searching dependent graphs…