Open sclarkson opened 1 month ago
@NicolasHug
This is still a problem. Here's a more direct example taken from a GH200.
$ pytest test_transforms.py -k test_adjust_hue
================================================= test session starts =================================================
platform linux -- Python 3.12.3, pytest-7.4.4, pluggy-1.4.0
rootdir: /home/ubuntu/vision
configfile: pytest.ini
plugins: anyio-4.4.0, hypothesis-6.98.15, xdist-3.4.0, rerunfailures-12.0, libtmux-0.30.2
collected 1316 items / 1315 deselected / 1 selected
test_transforms.py F [100%]
====================================================== FAILURES =======================================================
___________________________________________________ test_adjust_hue ___________________________________________________
test_transforms.py:976: in test_adjust_hue
torch.testing.assert_close(y_np, y_ans)
E AssertionError: Tensor-likes are not equal!
E
E Mismatched elements: 9 / 12 (75.0%)
E Greatest absolute difference: 226 at index (1, 0, 1)
E Greatest relative difference: 5.5 at index (0, 0, 2)
================================================== warnings summary ===================================================
test/test_transforms.py::test_adjust_hue
/home/ubuntu/.local/lib/python3.12/site-packages/torchvision/transforms/_functional_pil.py:113: RuntimeWarning: invalid value encountered in cast
np_h += np.array(hue_factor * 255).astype(np.uint8)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=============================================== short test summary info ===============================================
FAILED test_transforms.py::test_adjust_hue - AssertionError: Tensor-likes are not equal!
==================================== 1 failed, 1315 deselected, 1 warning in 0.42s ====================================
🐛 Describe the bug
https://github.com/pytorch/vision/pull/8463 introduced a platform/compiler specific cast. See this comment for more details. https://github.com/numpy/numpy/issues/23481#issuecomment-1488011976
I'll run this code snippet on x86_64 and ARM64 machines to demonstrate the problem.
x86_64:
ARM64:
Versions