code: def convert_to_numpy(tensor: Any):
      if isinstance(tensor, torch.Tensor):
          tensor = tensor.cpu().detach().numpy()
      elif isinstance(tensor, tf.Tensor) and tensor is not None:
          tensor = tensor.numpy()
      elif isinstance(tensor, int):
          tensor = np.array([tensor])
      else:
          if not isinstance(tensor, np.ndarray):
              raise TypeError(f"Unsupported data type: {type(tensor)}")
      return tensor
  
file_path: nebuly/optimization/nebullvm/nebullvm/tools/onnx.py
imports: from typing import List, Tuple, Any, Optional, Dict
  import numpy
  from loguru import logger
  from nebullvm.config import ONNX_PROVIDERS
  from nebullvm.core.models import DeepLearningFramework, Device, DeviceType, InputInfo, DataType
  from nebullvm.optional_modules.onnx import onnx
  from nebullvm.optional_modules.onnxruntime import onnxruntime
  from nebullvm.optional_modules.tensorflow import tensorflow
  from nebullvm.optional_modules.torch import torch
label_desc: Use image node_id 1 for calling a global function with example usage: convert_to_numpy(tensor) and returns: tensor