mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-02-19 02:44:40 -05:00
remove numpy from dtype (#4969)
replaced all dtype.np with _to_np_dtype defined in tensor.py. after this, the only numpy usages are (1) Tensor(np.ndarray), (2) construct .numpy() output, (3) numpy random buffer
This commit is contained in:
6
test/external/fuzz_schedule.py
vendored
6
test/external/fuzz_schedule.py
vendored
@@ -7,7 +7,7 @@ from tinygrad.helpers import DEBUG, MULTIOUTPUT, colored, getenv
|
||||
from tinygrad.lazy import LazyBuffer
|
||||
from tinygrad.engine.schedule import _graph_schedule, _LBScheduleItem, ScheduleItem
|
||||
from tinygrad.ops import LoadOps
|
||||
from tinygrad.tensor import Tensor
|
||||
from tinygrad.tensor import Tensor, _to_np_dtype
|
||||
|
||||
ctx_vars = { MULTIOUTPUT: (0, 1) }
|
||||
|
||||
@@ -60,8 +60,8 @@ def fuzz_schedule(outs:List[LazyBuffer]):
|
||||
si = ScheduleItem(ps.ast, tuple(rawbufs[x] for x in (ps.outputs+ps.inputs) if x.size != 0))
|
||||
_exec_si(si, seed)
|
||||
for out in ps.outputs:
|
||||
outbuf = np.frombuffer(rawbufs[out].as_buffer(), out.dtype.np)
|
||||
try: np.testing.assert_allclose(outbuf, np.frombuffer(ground_truth[out], out.dtype.np), atol=1e-2, rtol=1e-2)
|
||||
outbuf = np.frombuffer(rawbufs[out].as_buffer(), _to_np_dtype(out.dtype))
|
||||
try: np.testing.assert_allclose(outbuf, np.frombuffer(ground_truth[out], _to_np_dtype(out.dtype)), atol=1e-2, rtol=1e-2)
|
||||
except Exception as e:
|
||||
print(f"FAILED FOR {out}")
|
||||
raise e
|
||||
|
||||
Reference in New Issue
Block a user