fast resnet eval (#3135)

* fast resnet eval

* fix HIP multidevice graph

* neater expression for devices

* lines

* add decorator test
This commit is contained in:
George Hotz
2024-01-15 14:15:18 -08:00
committed by GitHub
parent b7b494e9b8
commit a464909d79
10 changed files with 222 additions and 56 deletions

View File

@@ -1,6 +1,6 @@
import unittest
import pickle
from tinygrad.helpers import diskcache_get, diskcache_put
from tinygrad.helpers import diskcache_get, diskcache_put, diskcache
def remote_get(table,q,k): q.put(diskcache_get(table, k))
def remote_put(table,k,v): diskcache_put(table, k, v)
@@ -50,6 +50,20 @@ class DiskCache(unittest.TestCase):
self.assertEqual(diskcache_get(table, 4), 5)
self.assertEqual(diskcache_get(table, "4"), 5)
def test_decorator(self):
calls = 0
@diskcache
def hello(x):
nonlocal calls
calls += 1
return "world"+x
self.assertEqual(hello("bob"), "worldbob")
self.assertEqual(hello("billy"), "worldbilly")
kcalls = calls
self.assertEqual(hello("bob"), "worldbob")
self.assertEqual(hello("billy"), "worldbilly")
self.assertEqual(kcalls, calls)
def test_dict_key(self):
table = "test_dict_key"
fancy_key = {"hello": "world", "goodbye": 7, "good": True, "pkl": pickle.dumps("cat")}