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))
def test_normalize_device_move(): norm = FeatureBatchNormalizer() x = torch.randn(10, 40, 1337) _test_device_move(norm, x)
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)
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)
def test_powerspectrum_device_move(**kwargs): spec = PowerSpectrum(**kwargs) x = torch.randn(10, 1337) _test_device_move(spec, x)
def test_preemph_filter_device_move(preemph): filt = PreEmphasisFilter(preemph) x = torch.randn(10, 1337) _test_device_move(filt, x)
def test_dither_device_move(dither_magnitude): dither = DitherAudio(dither_magnitude) x = torch.randn(10, 1337) _test_device_move(dither, x)