fix memory leaks, add gc test

This commit is contained in:
George Hotz
2020-12-06 10:34:40 -08:00
parent 1717daa859
commit 51daaa43d4
3 changed files with 70 additions and 20 deletions

View File

@@ -12,7 +12,7 @@ if __name__ == "__main__":
img = np.zeros((BS,3,224,224), dtype=np.float32)
for i in range(32):
print("running batch %d" % i)
print("running batch %d, %d tensors allocated" % (i, Tensor.allocated))
st = time.time()
out = model.forward(Tensor(img))
@@ -31,3 +31,5 @@ if __name__ == "__main__":
et = time.time()
print("backward %.2f s" % (et-st))
del out, y, loss