mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-04-07 03:00:26 -04:00
fix tests for delete lazy [pr] (#7980)
This commit is contained in:
@@ -120,7 +120,9 @@ class TestDType(unittest.TestCase):
|
||||
data = [1., 2., 0., 0.5, -1.5, 5.25]
|
||||
for dt in dtypes:
|
||||
arr = np.asarray(data).astype(dt)
|
||||
tin = Tensor(arr).numpy()
|
||||
tensor = Tensor(arr)
|
||||
if not is_dtype_supported(tensor.dtype): continue
|
||||
tin = tensor.numpy()
|
||||
tor = torch.as_tensor(arr).detach().numpy()
|
||||
assert dt == tin.dtype == tor.dtype, f"dtype mismatch: expected={dt} | tinygrad={tin.dtype} | torch={tor.dtype}"
|
||||
np.testing.assert_allclose(tin, tor, atol=1e-6, rtol=1e-3)
|
||||
|
||||
@@ -46,8 +46,9 @@ class TestTiny(unittest.TestCase):
|
||||
nonlocal cnt
|
||||
cnt += 1
|
||||
return a+b
|
||||
fa,fb = Tensor([1.,2,3]), Tensor([4.,5,6])
|
||||
for _ in range(3): fxn(fa, fb)
|
||||
for _ in range(3):
|
||||
fa,fb = Tensor([1.,2,3]), Tensor([4.,5,6])
|
||||
fxn(fa, fb)
|
||||
# function is only called twice
|
||||
self.assertEqual(cnt, 2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user