MCPcopy
hub / github.com/tinygrad/tinygrad / test_recursive_add_cmp

Method test_recursive_add_cmp

test/null/test_schedule.py:1181–1194  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1179 assert len(prg.src[3].arg.splitlines()) < 250
1180
1181 def test_recursive_add_cmp(self):
1182 st = time.perf_counter()
1183 a = Tensor([1,2,3,4])
1184 for _ in range(24): a = a + a
1185 linear1 = a.schedule_linear()
1186 b = Tensor([1,2,3,4])
1187 for _ in range(24): b = b + b
1188 linear2 = b.schedule_linear()
1189 c = Tensor([1,2,3,4])
1190 for _ in range(23): c = c + c
1191 linear3 = c.schedule_linear()
1192 self.assertEqual(linear1.src[-1].src[0], linear2.src[-1].src[0])
1193 with self.assertRaises(AssertionError): self.assertEqual(linear1.src[-1].src[0], linear3.src[-1].src[0])
1194 self.assertLess(time.perf_counter()-st, 2.0)
1195
1196 def test_recursive_pad(self):
1197 st = time.perf_counter()

Callers

nothing calls this directly

Calls 2

schedule_linearMethod · 0.95
TensorClass · 0.90

Tested by

no test coverage detected