mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-06-24 02:14:17 +00:00
fix tests for delete lazy [pr] (#7980)
This commit is contained in:
parent
254c86d712
commit
d53cd92364
2 changed files with 6 additions and 3 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue