fix assign (#3878)

* fix assign

* remove terrible optimizer hack

* oops, not realized assigns
This commit is contained in:
George Hotz
2024-03-22 11:48:48 -07:00
committed by GitHub
parent 5587594a00
commit 54dc48aa47
3 changed files with 9 additions and 8 deletions

View File

@@ -100,13 +100,12 @@ class TestAssign(unittest.TestCase):
new = a + times_a
np.testing.assert_allclose(new.numpy(), 5)
@unittest.expectedFailure
def test_assign_diamond_possible(self):
a = Tensor.ones(4).contiguous().realize()
times_a = a*3
a.assign(Tensor.full((4,), 2.).contiguous())
new = a + (times_a+1).contiguous()
np.testing.assert_allclose(new.numpy(), 6)
new = a + (times_a-1).contiguous()
np.testing.assert_allclose(new.numpy(), 4)
def test_assign_diamond_alt(self):
a = Tensor.ones(4).contiguous().realize()