code: def _preprocess_inputs(inputs, op_name, device, schema=None):
      """Promote all scalar values in the inputs tuple into operator-backed DataNodes.
  
      This operation needs to be performed first, so we can have less duplicated constant nodes
      when dealing with multiple input sets.
  
      Parameters
      ----------
      inputs : tuple
          The inputs can contain one level nesting of Multiple Input Sets.
      """
      if isinstance(inputs, tuple):
          inputs = list(inputs)
  
      def is_input(x):
          if isinstance(
              x, (_DataNode, nvidia.dali.types.ScalarConstant)
          ):
              return True
          # One level of nesting for Multiple Input Sets. It must be a List[DataNode/ScalarConstant]
          # with at least one DataNode.
          return (
              isinstance(x, (list))
              and any(isinstance(y, _DataNode) for y in x)
              and all(
                  isinstance(
                      y, (_DataNode, nvidia.dali.types.ScalarConstant)
                  )
                  for y in x
              )
          )
  
      def get_input_device(schema, input_idx):
          default_input_device = "gpu" if device == "gpu" else "cpu"
          if schema:
              input_device = (
                  schema.GetInputDevice(input_idx)
                  or default_input_device
              )
          else:
              input_device = default_input_device
          return input_device
  
      def _promote_scalar_constant(value, input_device):
          """When ScalarConstant is encountered, promote it to a DataNode, otherwise do
          a pass-through.
          """
          if isinstance(value, _ScalarConstant):
              return _instantiate_constant_node(value, input_device)
          return value
  
      for idx, inp in enumerate(inputs):
          if not is_input(inp):
              try:
                  inp = _Constant(
                      inp, device=get_input_device(schema, idx)
                  )
              except Exception as ex:
                  raise TypeError(
                      f"when calling operator {op_name}: "
                      f"expected inputs of type `DataNode`, list of `DataNode` "
                      f"or convertible to constant nodes. Received "
                      f"input `{idx}` of type '{type(inp).__name__}'."
                  ) from ex
  
          if not isinstance(inp, _DataNode):
              dev = get_input_device(schema, idx)
              # Process the single ScalarConstant or list possibly containing ScalarConstants
              # and promote each of them into a DataNode
              inp = tree.map_structure(
                  lambda val: _promote_scalar_constant(val, dev), inp
              )
  
          inputs[idx] = inp
      return inputs
  
imports: import sys
  import threading
  import tree
  import warnings
  from itertools import count
  import nvidia.dali.python_function_plugin
  from nvidia.dali import backend
  from nvidia.dali import fn
  from nvidia.dali import internal
  from nvidia.dali.data_node import DataNode
  from nvidia.dali.pipeline import Pipeline
  from nvidia.dali.types import _type_name_convert_to_string, _type_convert_value, _default_converter, _vector_element_type, ScalarConstant, Constant
  from nvidia.dali import _conditionals
  from nvidia.dali.ops import _registry, _names, _docs, _operator_utils
  from nvidia.dali.ops._registry import cpu_ops, mixed_ops, gpu_ops, register_cpu_op, register_gpu_op
  from nvidia.dali.ops._names import _op_name, _process_op_name, _schema_name
  from nvidia.dali.ops._operator_utils import _build_input_sets, _repack_output_sets
  from nvidia.dali.external_source import ExternalSource
  from nvidia.dali.ops._operators.python_function import PythonFunctionBase, PythonFunction, DLTensorPythonFunction, _dlpack_to_array, _dlpack_from_array
  from nvidia.dali.ops._operators.compose import Compose
  from nvidia.dali.ops._operators.math import _arithm_op, _group_inputs, _generate_input_desc
label_desc: Use image node_id 18 for calling a global function with example usage: _preprocess_inputs(inputs, op_name, device, schema) and returns: inputs, unknown, input_device, value, True, _instantiate_constant_node