keunwoochoi / torchaudio-contrib

A test bed for updates and new features | pytorch/audio
169 stars 22 forks source link

Stft #57

Closed keunwoochoi closed 5 years ago

keunwoochoi commented 5 years ago

(oh damn, it's mixed with #56....)

@hagenw do you know how to do this with pytest?

hagenw commented 5 years ago

If the test success depends on a combination of different parameters, you can also combine them yourself, e.g. change

@pytest.mark.parametrize('fft_len', [512])
@pytest.mark.parametrize('hop_len', [256])
@pytest.mark.parametrize('waveform', [
    (torch.randn(1, 100000)),
    (torch.randn(1, 2, 100000)),
    pytest.param(torch.randn(1, 100), marks=xfail(raises=RuntimeError)),
])
@pytest.mark.parametrize('pad_mode', [
    # 'constant',
    'reflect',
])

to

@pytest.mark.parametrize('waveform,pad_mode,fft_len,'hop_len'', [
    (torch.randn(1, 100000), 'constant', 512, 256),
    (torch.randn(1, 2, 100000), 'constant', 512, 256),
    (torch.randn(1, 100), 'constant', 512, 256),
    (torch.randn(1, 100000), 'reflect', 512, 256),
    (torch.randn(1, 2, 100000), 'reflect', 512, 256),
    pytest.param(torch.randn(1, 100), 'reflect', 512, 256, marks=xfail(raises=RuntimeError)),
])

Now you have to specify every case yourself.

keunwoochoi commented 5 years ago

@hagenw Thanks. I think we can do it by creating two classes that simply inherits from the test, I'll push it later.

keunwoochoi commented 5 years ago

On testing - because we're gonna rely on torch.stft for the padding, i won't worry about pad test too much here.