code: def external_source_converter_with_fixed_value(
      shape, dtype, tensor, batch="dataset"
  ):
      def to_dataset(pipeline_desc, device_str):
          dataset_pipeline, shapes, dtypes = pipeline_desc
  
          with tf.device("/cpu:0"):
              input_dataset = tf.data.Dataset.from_tensors(
                  tensor
              ).repeat()
              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 = {"input_placeholder": input_dataset}
          else:
              input_datasets = {
                  "input_placeholder": 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 3 for calling a global function with example usage: external_source_converter_with_fixed_value(shape, dtype, tensor, batch) and returns: to_dataset, dali_dataset