code: def check_shuffling_patterns(
      dataset,
      num_gpus,
      batch_size,
      stick_to_shard,
      shuffle_after_epoch,
      dry_run_num,
      len_ref_img_ids,
  ):
      random_shuffle = not shuffle_after_epoch
      pad_last_batch = batch_size != 1
      pipes = [
          COCOReaderPipeline(
              batch_size=batch_size,
              num_threads=4,
              shard_id=gpu,
              num_gpus=num_gpus,
              data_paths=dataset,
              random_shuffle=random_shuffle,
              stick_to_shard=stick_to_shard,
              shuffle_after_epoch=shuffle_after_epoch,
              pad_last_batch=pad_last_batch,
              initial_fill=1,
          )
          for gpu in range(num_gpus)
      ]
  
      if stick_to_shard and shuffle_after_epoch:
          return
  
      [pipe.build() for pipe in pipes]
      dataset_size = pipes[0].epoch_size("Reader")
  
      # dry run
      for j in range(dry_run_num):
          for n in range(num_gpus):
              mod = j
              if stick_to_shard or shuffle_after_epoch:
                  mod = 0
              if pad_last_batch:
                  shard_size = dataset_size // num_gpus
              else:
                  shard_size = (
                      dataset_size * (n + 1 + mod) // num_gpus
                      - dataset_size * (n + mod) // num_gpus
                  )
              iters = shard_size // batch_size
              if shard_size != iters * batch_size:
                  iters += 1
              for _ in range(iters):
                  pipes[n].run()
  
      new_img_ids = []
      for n in range(num_gpus):
          mod = dry_run_num
          if stick_to_shard or shuffle_after_epoch:
              mod = 0
          if pad_last_batch:
              shard_size = dataset_size // num_gpus
          else:
              shard_size = (
                  dataset_size * (n + 1 + mod) // num_gpus
                  - dataset_size * (n + mod) // num_gpus
              )
          iters = shard_size // batch_size
          if shard_size != iters * batch_size:
              iters += 1
          for _ in range(iters):
              val = np.concatenate(pipes[n].run()[0].as_array())
              new_img_ids.append(val)
      new_img_ids = set(np.concatenate(new_img_ids))
  
      assert len(new_img_ids) == len_ref_img_ids
  
imports: import nose_utils
  import math
  from nvidia.dali.pipeline import Pipeline
  import nvidia.dali.ops
  import numpy
  import os
  from test_utils import get_dali_extra_path
label_desc: Use image node_id 2 for calling a global function with example usage: check_shuffling_patterns(dataset, num_gpus, batch_size, stick_to_shard, shuffle_after_epoch, dry_run_num, len_ref_img_ids) without return types