code: def get_pipe_dataset(
      batch_size,
      num_threads,
      device,
      device_id,
      num_devices=1,
      *,
      dali_on_dev_0=True,
      get_pipeline_desc=get_image_pipeline,
      to_dataset=to_image_dataset,
  ):
      shard_id = 0 if num_devices == 1 else device_id
  
      tf_dataset = get_dali_dataset(
          batch_size,
          num_threads,
          device,
          device_id,
          num_devices=num_devices,
          get_pipeline_desc=get_pipeline_desc,
          to_dataset=to_dataset,
      )
  
      dali_pipeline, _, _ = get_pipeline_desc(
          batch_size,
          num_threads,
          device,
          0 if dali_on_dev_0 else device_id,
          shard_id,
          num_devices,
          def_for_dataset=False,
      )
  
      return dali_pipeline, tf_dataset
  
imports: import math
  import numpy
  import nvidia.dali.fn
  import nvidia.dali.plugin.tf
  import nvidia.dali.types
  import os
  import tensorflow
  from contextlib import contextmanager
  from nose import SkipTest
  from nvidia.dali.pipeline import Pipeline
  from tensorflow.python.client import device_lib
  from test_utils import to_array, get_dali_extra_path
label_desc: Use image node_id 11 for calling a global function with example usage: get_pipe_dataset(batch_size, num_threads, device, device_id, num_devices) and returns: dali_pipeline,  tf_dataset