Files
tinygrad/test/test_to_numpy.py
Christopher Mauri Milan 7f01dd04f0 Apply ruff linting rules to tests (#2473)
* everything except F821

* enable F821 with noqa

* dumb fix

* fix remaining imports and (former) lambdas

* replace _ with noqa to avoid gc
2023-11-27 21:24:06 -08:00

17 lines
436 B
Python

from tinygrad.tensor import Tensor
import numpy as np
import pickle
import unittest
class TestToNumpy(unittest.TestCase):
def test_numpy_is_numpy(self):
output = Tensor.ones((1, 3, 4096)).realize().numpy()
new = np.copy(output)
print(type(new))
serialized = pickle.dumps(new)
out = pickle.loads(serialized)
assert out.shape == (1,3,4096)
assert (out==1).all()
if __name__ == '__main__':
unittest.main()