code: def __init__(
      self,
      function,
      num_outputs=1,
      device="cpu",
      batch_processing=False,
      **kwargs,
  ):
      if device == "gpu":
          _setup_cupy()
  
      if device == "cpu":
  
          def func(*ts):
              return self._function_wrapper_cpu(
                  batch_processing, function, num_outputs, *ts
              )
  
      else:
  
          def func(*ts):
              return self._function_wrapper_gpu(
                  batch_processing, function, num_outputs, *ts
              )
  
      super(PythonFunction, self).__init__(
          impl_name="DLTensorPythonFunctionImpl",
          function=func,
          num_outputs=num_outputs,
          device=device,
          synchronize_stream=False,
          batch_processing=batch_processing,
          **kwargs,
      )
  
imports: import nvidia.dali.python_function_plugin
  from nvidia.dali import backend
  from nvidia.dali import ops
  from nvidia.dali.ops import _registry
  from nvidia.dali.data_node import DataNode
  from nvidia.dali.pipeline import Pipeline
  from nvidia.dali.types import CUDAStream
label_desc: Use image node_id 8 to create a new PythonFunction object from inherited base classes: PythonFunctionBase with example: obj = PythonFunction(function, num_outputs, device, batch_processing)