MCPcopy
hub / github.com/tinygrad/tinygrad / test_sum_matches_torch

Method test_sum_matches_torch

extra/torch_backend/test.py:497–501  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

495 for tr, cr in zip(tiny_chunks, cpu_chunks): np.testing.assert_equal(tr, cr)
496
497 def test_sum_matches_torch(self):
498 a = torch.arange(6, dtype=torch.float32, device=device).reshape(2,3)
499 torch_res = a.sum().cpu().numpy()
500 cpu_res = torch.arange(6, dtype=torch.float32).reshape(2,3).sum().numpy()
501 np.testing.assert_equal(torch_res, cpu_res)
502
503 def test_view_matches_torch(self):
504 a = torch.arange(6, dtype=torch.float32, device=device)

Callers

nothing calls this directly

Calls 5

reshapeMethod · 0.80
arangeMethod · 0.80
sumMethod · 0.80
assert_equalMethod · 0.80
numpyMethod · 0.45

Tested by

no test coverage detected