Files
tinygrad/test/test_arange.py
George-the-1st 0627e26140 Added missing unittest execution code (#4400)
same code as on every other test file, just missing from this one for some reason.
2024-05-02 22:34:30 -04:00

17 lines
463 B
Python

import unittest
from tinygrad import Tensor, GlobalCounters
class TestArange(unittest.TestCase):
def _get_flops(self, N):
GlobalCounters.reset()
Tensor.arange(N).realize()
return GlobalCounters.global_ops
def test_complexity(self):
f1 = self._get_flops(256)
f2 = self._get_flops(2560)
print(f"{f1=}, {f2=}")
assert f2 / f1 < 15, f"bad complexity, flops {f2/f1:.1f}X while inputs 10X"
if __name__ == "__main__":
unittest.main()