code: def _testimpl_types_and_shapes(
      np_rng,
      device,
      shapes,
      num_outputs,
      type,
      batch_size,
      num_threads,
      compressed_arg,
      file_arg_type,
  ):
      """compare reader with astropy, with different batch_size and num_threads"""
  
      nsamples = len(shapes)
      # setup files
      with tempfile.TemporaryDirectory() as test_data_root:
          # setup file
          filenames = [
              "test_{:02d}.fits".format(i) for i in range(nsamples)
          ]
          full_paths = [
              os.path.join(test_data_root, fname) for fname in filenames
          ]
          for i in range(nsamples):
              compressed = compressed_arg
              if compressed is None:
                  compressed = random.choice([False, True])
              create_fits_file(
                  np_rng,
                  full_paths[i],
                  shapes[i],
                  type,
                  compressed,
                  num_outputs,
              )
  
          # load manually, we skip primary HDU since it only stores metadata
          # astropy returns data from each HDUs as a ndarray
          hduls = [fits.open(filename) for filename in full_paths]
          arrays = [hdu.data for hdul in hduls for hdu in hdul[1:]]
          hdu_indices = list(range(2, num_outputs + 2))
  
          # load with numpy reader
          file_list_arg = None
          files_arg = None
          file_filter_arg = None
          if file_arg_type == "file_list":
              file_list_arg = os.path.join(test_data_root, "input.lst")
              with open(file_list_arg, "w") as f:
                  f.writelines("\n".join(filenames))
          elif file_arg_type == "files":
              files_arg = filenames
          elif file_arg_type == "file_filter":
              file_filter_arg = "*.fits"
          else:
              assert False
  
          pipe = FitsReaderPipeline(
              path=test_data_root,
              files=files_arg,
              file_list=file_list_arg,
              file_filter=file_filter_arg,
              device=device,
              batch_size=batch_size,
              num_threads=num_threads,
              device_id=0,
              hdu_indices=hdu_indices,
          )
  
          try:
              pipe.build()
              i = 0
              while i < nsamples:
                  pipe_out = pipe.run()
                  for s in range(batch_size):
                      if i >= nsamples:
                          break
                      for out_idx in range(num_outputs):
                          pipe_arr = to_array(pipe_out[out_idx][s])
                          ref_arr = arrays[i + out_idx]
                          assert_array_equal(pipe_arr, ref_arr)
                      i += num_outputs
          finally:
              del pipe
  
imports: import itertools
  import os
  import sys
  from nvidia.dali import pipeline_def
  import nvidia.dali.fn
  from astropy.io import fits
  import numpy
  import tempfile
  import random
  from nose2.tools import params
  from test_utils import to_array, get_dali_extra_path
  from numpy.testing import assert_array_equal
label_desc: Use image node_id 5 for calling a global function with example usage: _testimpl_types_and_shapes(np_rng, device, shapes, num_outputs, type, batch_size, num_threads, compressed_arg, file_arg_type) without return types