code: def safe_numpy(t) -> np.ndarray:
      if not isinstance(t, Tensor):
          return t
      global numpy_cache
      if t not in numpy_cache:
          if DEBUG >= 3:
              print("numpy cache miss", t)
          tmp = t.numpy()
          numpy_cache[t] = tmp
      return numpy_cache[t]
  
file_path: tinygrad/extra/onnx.py
imports: from __future__ import annotations
  from google.protobuf.internal.containers import RepeatedCompositeFieldContainer
  import importlib
  import numpy
  from tinygrad import Tensor, dtypes, Device
  from tinygrad.helpers import getenv, DEBUG
  from typing import List, Dict
  from onnx import AttributeProto, ModelProto, TensorProto, TypeProto
label_desc: Use image node_id 1 for calling a global function with example usage: safe_numpy(t) and returns: numpy_cache, t