Commit d65a0f3e authored by moto's avatar moto Committed by Facebook GitHub Bot
Browse files

Loosen atol for melscale batch test for Windows (#2305)

Summary:
The `transforms.batch_consistency_test.TestTransforms` test is failing for Windows.

https://app.circleci.com/pipelines/github/pytorch/audio/10093/workflows/bbe003c4-3dfa-4729-a3e1-c942ab1243d4/jobs/594272

```
>       self.assertEqual(items_result, batch_result, rtol=rtol, atol=atol)
E       AssertionError: Tensor-likes are not close!
E
E       Mismatched elements: 28 / 196608 (0.0%)
E       Greatest absolute difference: 2.0023435354232788e-07 at index (1, 1, 127, 100) (up to 1e-08 allowed)
E       Greatest relative difference: 0.0005069057444598896 at index (0, 0, 114, 129) (up to 1e-05 allowed)
```

The value of atol==1e-08 seems very strict but all the other batch
consistency tests are passing.

The violation is for very small number of samples, which looks
suspicious, but I think it is okay to reduce it to `1e-06` for Windows.

`1e-06` is still more strict than the majority of the comparison tests we have.

Pull Request resolved: https://github.com/pytorch/audio/pull/2305

Reviewed By: hwangjeff

Differential Revision: D35298056

Pulled By: mthrok

fbshipit-source-id: a7d20f408c16cff7d363f4a9462c64e19d1c99f7
parent c6c6b689
"""Test numerical consistency among single input and batched input."""
import os
import torch
from parameterized import parameterized
from torchaudio import transforms as T
......@@ -40,9 +42,11 @@ class TestTransforms(common_utils.TorchaudioTestCase):
def test_batch_MelScale(self):
specgram = torch.randn(3, 2, 201, 256)
atol = 1e-6 if os.name == "nt" else 1e-8
transform = T.MelScale()
self.assert_batch_consistency(transform, specgram)
self.assert_batch_consistency(transform, specgram, atol=atol)
def test_batch_InverseMelScale(self):
n_mels = 32
......
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