From 44e0eab8fdcec7ac81f1ebeac4bb3ef1e7537a1c Mon Sep 17 00:00:00 2001 From: Josh Moore Date: Wed, 5 Feb 2025 21:56:29 -0500 Subject: [PATCH] Fix AttributeError occurring after ValueError in _apply_uop (#8905) * Fix AttributeError occurring after ValueError in _apply_uop * Update tensor.py --------- Co-authored-by: George Hotz <72895+geohot@users.noreply.github.com> --- test/test_tensor.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/test_tensor.py b/test/test_tensor.py index f7c63ef90d..6ab3f504f3 100644 --- a/test/test_tensor.py +++ b/test/test_tensor.py @@ -485,6 +485,12 @@ class TestTinygrad(unittest.TestCase): subprocess.run([f'NPY=1 {Device.DEFAULT}=1 python3 -c "from tinygrad import Device; assert Device.DEFAULT == \\"{Device.DEFAULT}\\""'], shell=True, check=True) + def test_no_attributeerror_after_apply_uop_exception(self): + try: + Tensor.arange(4).reshape(3,2) + except ValueError: + Tensor.zeros(2, 2).realize() + @unittest.skip("this test is just flaky, sync issue") class TestMoveTensor(unittest.TestCase): d0, d1 = f"{Device.DEFAULT}:0", f"{Device.DEFAULT}:1"