code: def check_audio_decoder_correctness(fmt, dtype):
      batch_size = 16
      niterations = 10
  
      @pipeline_def(batch_size=batch_size, device_id=0, num_threads=4)
      def audio_decoder_pipe(fnames, dtype, downmix=False):
          encoded, _ = fn.readers.file(files=fnames)
          decoded, _ = fn.decoders.audio(
              encoded, dtype=dtype, downmix=downmix
          )
          return decoded
  
      audio_files = get_files(os.path.join("db", "audio", fmt), fmt)
      npy_files = [
          os.path.splitext(fpath)[0] + ".npy" for fpath in audio_files
      ]
      pipe = audio_decoder_pipe(audio_files, dtype)
      pipe.build()
      for it in range(niterations):
          data = pipe.run()
          for s in range(batch_size):
              sample_idx = (it * batch_size + s) % len(audio_files)
              ref = np.load(npy_files[sample_idx])
              if len(ref.shape) == 1:
                  ref = np.expand_dims(ref, 1)
              arr = np.array(data[0][s])
              assert arr.shape == ref.shape
              if fmt == "ogg":
                  # For OGG Vorbis, we consider errors any value that is off by more than 1
                  # TODO(janton): There is a bug in libsndfile that produces underflow/overflow.
                  #               Remove this when the bug is fixed.
                  # Tuple with two arrays, we just need the first dimension
                  wrong_values = np.where(np.abs(arr - ref) > 1)[0]
                  nerrors = len(wrong_values)
                  assert nerrors <= 1
                  # TODO(janton): Uncomment this when the bug is fixed
                  # np.testing.assert_allclose(arr, ref, atol=1)
              else:
                  np.testing.assert_equal(arr, ref)
  
imports: from nvidia.dali import Pipeline, pipeline_def
  import nvidia.dali.fn
  import nvidia.dali.ops
  import nvidia.dali.types
  import scipy.io.wavfile
  import numpy
  import os
  from test_audio_decoder_utils import generate_waveforms, rosa_resample
  from test_utils import compare_pipelines, get_files
label_desc: Use image node_id 6 for calling a global function with example usage: check_audio_decoder_correctness(fmt, dtype) and returns: decoded