".github/vscode:/vscode.git/clone" did not exist on "9812d57c1196856f9f6c526d0ad0191cad403f6b"
  • Yanghan Wang's avatar
    use torch.testing.assert_close in test_modeling_distillation · c088c257
    Yanghan Wang authored
    Summary:
    Pull Request resolved: https://github.com/facebookresearch/d2go/pull/455
    
    The test can be flaky due to numerical mismatch if using `self.AssertEqual`, eg. https://www.internalfb.com/intern/testinfra/diagnostics/1688850007977704.562950031998292.1672749571/
    
    ```
    Traceback (most recent call last):
      File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/buck-out/v2/gen/fbcode/104a4d5c3a690252/mobile-vision/d2go/tests/__modeling_test_modeling_distillation__/modeling_test_modeling_distillation#link-tree/d2go/tests/modeling/test_modeling_distillation.py", line 674, in test_da_train
        self.assertEqual(
    AssertionError: {'rea[14 chars]2894], grad_fn=<MulBackward0>), 'synthetic': t[85 chars]d0>)} != {'rea[14 chars]2894]), 'synthetic': tensor([1.4532]), 'add': [13 chars]64])}
    - {'add': tensor([18.0064], grad_fn=<MulBackward0>),
    -  'real': tensor([0.2894], grad_fn=<MulBackward0>),
    -  'synthetic': tensor([1.4532], grad_fn=<MulBackward0>)}
    + {'add': tensor([18.0064]),
    +  'real': tensor([0.2894]),
    +  'synthetic': tensor([1.4532])}
    ```
    
    .Change to use `torch.testing.assert_close` instead for tensor comparison.
    
    Reviewed By: YanjunChen329
    
    Differential Revision: D42352509
    
    fbshipit-source-id: 8a647685d1347a9bd493f2faed7e066eb9159e14
    c088c257
test_modeling_distillation.py 28.9 KB