mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-02-16 17:45:38 -05:00
17 lines
368 B
Python
17 lines
368 B
Python
import weakref
|
|
import numpy as np
|
|
from tinygrad.tensor import Tensor, Device
|
|
Device.DEFAULT = "METAL"
|
|
|
|
if __name__ == "__main__":
|
|
t = Tensor.zeros(3).realize()
|
|
wt = weakref.ref(t.lazydata.realized)
|
|
n = t.numpy()
|
|
t += 1
|
|
n2 = t.numpy()
|
|
print(wt)
|
|
del t
|
|
print(wt)
|
|
print(n, n.base, n.base.base)
|
|
print(n2, n2.base, n2.base.base)
|
|
assert wt() is not None |