no torch test if no torch

This commit is contained in:
George Hotz
2022-08-29 15:29:19 -07:00
parent 5eba228844
commit 880707f2d2

View File

@@ -169,10 +169,13 @@ def compile(input, output_fn):
# float32 only
FLOAT16 = int(os.getenv("FLOAT16", 0))
if FLOAT16 == 0:
from test.test_onnx import run_onnx_torch
torch_out = run_onnx_torch(onnx_model, np_inputs).numpy()
print(tinygrad_out_np, torch_out)
np.testing.assert_allclose(torch_out, tinygrad_out_np, atol=1e-4, rtol=1e-2)
try:
from test.test_onnx import run_onnx_torch
torch_out = run_onnx_torch(onnx_model, np_inputs).numpy()
print(tinygrad_out_np, torch_out)
np.testing.assert_allclose(torch_out, tinygrad_out_np, atol=1e-4, rtol=1e-2)
except ModuleNotFoundError:
pass
# save local_cl_cache as thneed
import struct, json