code: def test_vs_onnx(
      onnx_data,
      schedule: Optional[List[ScheduleItem]],
      inputs: Dict[str, Tensor],
  ):
      import onnx
  
      # import pyopencl as cl
      # from extra.thneed import Thneed
      import numpy as np
  
      onnx_model = onnx.load(io.BytesIO(onnx_data))
  
      input_shapes = {
          inp.name: tuple(
              x.dim_value for x in inp.type.tensor_type.shape.dim
          )
          for inp in onnx_model.graph.input
      }
      Tensor.manual_seed(1337)
      new_inputs = {
          k: Tensor.randn(*shp, requires_grad=False) * 8
          for k, shp in input_shapes.items()
      }
      new_np_inputs = {
          k: v.realize().numpy() for k, v in new_inputs.items()
      }
  
      if getenv("ORT"):
          # test with onnxruntime
          import onnxruntime as ort
  
          onnx_session = ort.InferenceSession(onnx_data)
          onnx_output = onnx_session.run(
              [onnx_model.graph.output[0].name],
              {
                  k: v.astype(np.float16)
                  for k, v in new_np_inputs.items()
              },
          )
          new_torch_out = onnx_output[0]
          print("got ort outputs")
      else:
          # test with torch
          from test.models.test_onnx import run_onnx_torch
  
          new_torch_out = run_onnx_torch(
              onnx_model, new_np_inputs
          ).numpy()
          print("got torch outputs")
  
      # if you don't have a schedule
      if schedule is None:
          run_onnx = get_run_onnx(onnx_model)
          new_tinygrad_out = (
              next(iter(run_onnx(new_inputs).values()))
              .cast(dtypes.float32)
              .numpy()
          )
          np.testing.assert_allclose(
              new_torch_out, new_tinygrad_out, atol=1e-4, rtol=1e-2
          )
          print("classic self-test passed!")
          return
  
      # set inputs
      for k, v in inputs.items():
          v.lazydata.base.realized.copyin(new_np_inputs[k].data)
  
      # run code (all buffers have been allocated)
      GlobalCounters.reset()
      for si in schedule:
          lower_schedule_item(si)(
              [si.out.realized] + [x.realized for x in si.inputs], {}
          )
  
      new_tinygrad_out = Tensor(schedule[-1].out).numpy()
      np.testing.assert_allclose(
          new_torch_out, new_tinygrad_out, atol=1e-4, rtol=1e-2
      )
      print("semi-thneed self-test passed!")
  
file_path: tinygrad/openpilot/compile2.py
imports: import os, sys, io, pathlib, re
  import onnx
  from tqdm import tqdm
  from typing import Tuple, List, Optional, Dict
  from extra.onnx import get_run_onnx
  from tinygrad import Tensor, Device, GlobalCounters, dtypes
  from tinygrad.dtype import ImageDType
  from tinygrad.helpers import partition, Context, fetch, getenv, GRAPH, DEBUG
  from tinygrad.realize import run_schedule, lower_schedule_item
  from tinygrad.ops import LoadOps, ScheduleItem
label_desc: Use image node_id 2 for calling a global function with example usage: test_vs_onnx(onnx_data, schedule, inputs) without return types