Unverified Commit 1a297ef2 authored by Mike Ruberry's avatar Mike Ruberry Committed by GitHub
Browse files

Updates test_transform.py to no longer perform floor division (#677)



* Updates test_transform.py to no longer perform floor division using torch.div

This will prevent this test from breaking when torch.div is updating to throw a runtime error when it would have performed floor division.

* flake8
Co-authored-by: default avatarVincent QB <vincentqb@users.noreply.github.com>
parent 9e27cf3d
...@@ -31,7 +31,10 @@ class Tester(TestCase): ...@@ -31,7 +31,10 @@ class Tester(TestCase):
quantization_channels = 256 quantization_channels = 256
waveform = self.waveform.clone() waveform = self.waveform.clone()
if not waveform.is_floating_point():
waveform = waveform.to(torch.get_default_dtype())
waveform /= torch.abs(waveform).max() waveform /= torch.abs(waveform).max()
self.assertTrue(waveform.min() >= -1. and waveform.max() <= 1.) self.assertTrue(waveform.min() >= -1. and waveform.max() <= 1.)
waveform_mu = transforms.MuLawEncoding(quantization_channels)(waveform) waveform_mu = transforms.MuLawEncoding(quantization_channels)(waveform)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment