NVIDIA / apex

A PyTorch Extension: Tools for easy mixed precision and distributed training in Pytorch
BSD 3-Clause "New" or "Revised" License
8.42k stars 1.4k forks source link

Update test_transducer_joint.py #1767

Closed nWEIdia closed 10 months ago

nWEIdia commented 10 months ago

Increase tolerance to workaround unit test failures

torch.testing.assert_close(f_grad_ref, f_grad_tst, atol=1e-5, rtol=1e-5) Mismatched elements: 1 / 205636 (0.0%) Greatest absolute difference: 3.0517578125e-05 at index (3, 27, 390) (up to 1e-05 allowed) Greatest relative difference: 0.000492095947265625 at index (3, 27, 390) (up to 1e-05 allowed)

torch.testing.assert_close(g_grad_ref, g_grad_tst, atol=1e-4, rtol=1e-4) Mismatched elements: 1 / 51200 (0.0%) Greatest absolute difference: 0.0009765625 at index (0, 15, 280) (up to 0.0001 allowed) Greatest relative difference: 0.0008397102355957031 at index (0, 15, 280) (up to 0.0001 allowed)

nWEIdia commented 10 months ago

Would all the cases need this change, out of curiosity?

These two mismatches were from two different tests, test_transducer_joint_pack_relu, and test_transducer_joint_vec_pack.