コード例 #1
0
def test_QuartznetBlock_device_move(**kwargs):
    try:
        block = QuartznetBlock(**kwargs)
    except ValueError:
        return
    x = torch.randn(10, kwargs["in_channels"], 1337)
    lens = torch.randint(10, 1337, (10, ))
    _test_device_move(block, (x, lens))
コード例 #2
0
def test_normalize_device_move():
    norm = FeatureBatchNormalizer()
    x = torch.randn(10, 40, 1337)
    _test_device_move(norm, x)
コード例 #3
0
def test_filterbank_device_move(**kwargs):
    fb = FilterbankFeatures(**kwargs)
    x = torch.randn(10, 1337)
    # Relaxed tolerance because of log operation
    # inside the Melscale
    _test_device_move(fb, x, atol=1e-3)
コード例 #4
0
def test_melscale_device_move(**kwargs):
    mel = MelScale(**kwargs)
    x = torch.randn(10, int(1 + kwargs["n_fft"] // 2), 137).abs()
    _test_device_move(mel, x)
コード例 #5
0
def test_powerspectrum_device_move(**kwargs):
    spec = PowerSpectrum(**kwargs)
    x = torch.randn(10, 1337)
    _test_device_move(spec, x)
コード例 #6
0
def test_preemph_filter_device_move(preemph):
    filt = PreEmphasisFilter(preemph)
    x = torch.randn(10, 1337)
    _test_device_move(filt, x)
コード例 #7
0
def test_dither_device_move(dither_magnitude):
    dither = DitherAudio(dither_magnitude)
    x = torch.randn(10, 1337)
    _test_device_move(dither, x)