code: def _torchscript_wrapper(device, function, *inputs, extra_config={}):
      """
      This function contains the code to enable predictions over torchscript models.
      It is used to translates inputs in the proper torch format.
      """
      inputs = [*inputs]
  
      with torch.no_grad():
          if DataFrame is not None and isinstance(inputs, DataFrame):
              # Split the dataframe into column ndarrays
              inputs = inputs[0]
              input_names = list(inputs.columns)
              splits = [
                  inputs[input_names[idx]]
                  for idx in range(len(input_names))
              ]
              splits = [df.to_numpy().reshape(-1, 1) for df in splits]
              inputs = tuple(splits)
  
          # Maps data inputs to the expected type and device.
          for i in range(len(inputs)):
              if type(inputs[i]) is list:
                  inputs[i] = np.array(inputs[i])
              if type(inputs[i]) is np.ndarray:
                  # Convert string arrays into int32.
                  if (
                      inputs[i].dtype.kind
                      in constants.SUPPORTED_STRING_TYPES
                  ):
                      assert constants.MAX_STRING_LENGTH in extra_config
  
                      inputs[i] = from_strings_to_ints(
                          inputs[i],
                          extra_config[constants.MAX_STRING_LENGTH],
                      )
                  if inputs[i].dtype == np.float64:
                      # We convert double precision arrays into single precision. Sklearn does the same.
                      inputs[i] = inputs[i].astype("float32")
                  inputs[i] = torch.from_numpy(inputs[i])
              elif type(inputs[i]) is not torch.Tensor:
                  raise RuntimeError(
                      "Inputer tensor {} of not supported type {}".format(
                          i, type(inputs[i])
                      )
                  )
              if device.type != "cpu" and device is not None:
                  inputs[i] = inputs[i].to(device)
          return function(*inputs)
  
imports: import pickle
  import os
  import numpy
  import shutil
  import torch
  import warnings
  import hummingbird
  from hummingbird.ml._utils import pandas_installed, get_device, from_strings_to_ints, dump_versions, check_dumped_versions
  from hummingbird.ml.operator_converters import constants
  from hummingbird.ml.containers._sklearn_api_containers import SklearnContainer, SklearnContainerTransformer, SklearnContainerRegression, SklearnContainerClassification, SklearnContainerAnomalyDetection
label_desc: Use image node_id 1 for calling a global function with example usage: _torchscript_wrapper(device, function) and returns: function