code: def external_source_converter_multiple(
      start_values, input_names, batches
  ):
      def to_dataset(pipeline_desc, device_str):
          dataset_pipeline, shapes, dtypes = pipeline_desc
  
          input_datasets = {}
          with tf.device("/cpu:0"):
              for value, name, batch in zip(
                  start_values, input_names, batches
              ):
                  tf_type = tf.dtypes.as_dtype(value.dtype)
                  shape = value.shape
                  input_dataset = tf.data.Dataset.from_generator(
                      InfiniteSampleIterator,
                      output_types=tf_type,
                      output_shapes=shape,
                      args=(value,),
                  )
                  if batch is None or batch is True:
                      input_dataset = input_dataset.batch(
                          dataset_pipeline.max_batch_size
                      )
                  # If we place DALIDataset on GPU we need the remote call + manual data transfer
                  if "gpu" in device_str:
                      input_dataset = input_dataset.apply(
                          tf.data.experimental.copy_to_device("/gpu:0")
                      )
                  if batch == "dataset":
                      input_datasets[name] = input_dataset
                  else:
                      input_datasets[name] = dali_tf.experimental.Input(
                          input_dataset, batch=batch
                      )
  
          with tf.device(device_str):
              dali_dataset = dali_tf.experimental.DALIDatasetWithInputs(
                  input_datasets=input_datasets,
                  pipeline=dataset_pipeline,
                  batch_size=dataset_pipeline.max_batch_size,
                  output_shapes=shapes,
                  output_dtypes=dtypes,
                  num_threads=dataset_pipeline.num_threads,
                  device_id=dataset_pipeline.device_id,
              )
          return dali_dataset
  
      return to_dataset
  
imports: import numpy
  import nvidia.dali
  import nvidia.dali.fn
  import nvidia.dali.plugin.tf
  import tensorflow
  from nose.tools import nottest
  from nvidia.dali import pipeline_def
  from test_utils import RandomlyShapedDataIterator
label_desc: Use image node_id 7 for calling a global function with example usage: external_source_converter_multiple(start_values, input_names, batches) and returns: to_dataset, dali_dataset