code: def _test_type_conversion(
      device, src_type, in_values, dst_type, out_values, eps
  ):
      src_nptype = dali_type_to_np(src_type)
      dst_nptype = dali_type_to_np(dst_type)
      assert len(out_values) == len(in_values)
      in_data = [
          np.full((100 + 10 * i,), x, src_nptype)
          for i, x in enumerate(in_values)
      ]
  
      @pipeline_def(batch_size=len(in_values))
      def test_pipe(device):
          input = fn.external_source(
              in_data, batch=False, cycle="quiet", device=device
          )
          return fn.audio_resample(
              input, dtype=dst_type, scale=1, quality=0
          )
  
      pipe = test_pipe(device, device_id=0, num_threads=4)
      pipe.build()
      for _ in range(2):
          (out,) = pipe.run()
          assert len(out) == len(out_values)
          assert out.dtype == dst_type
          for i in range(len(out_values)):
              ref = np.full_like(in_data[i], out_values[i], dst_nptype)
              out_arr = as_array(out[i])
              if not np.allclose(out_arr, ref, 1e-6, eps):
                  print("Actual: ", out_arr)
                  print(out_arr.dtype, out_arr.shape)
                  print("Reference: ", ref)
                  print(ref.dtype, ref.shape)
                  print("Diff: ", out_arr.astype(np.float) - ref)
                  assert np.allclose(out_arr, ref, 1e-6, eps)
  
file_path: DALI/dali/test/python/operator_1/test_audio_resample.py
imports: import numpy
  import scipy.io.wavfile
  from nvidia.dali import fn, pipeline_def, types
  from test_audio_decoder_utils import generate_waveforms
  from test_utils import check_batch, dali_type_to_np, as_array
label_desc: Use image node_id 5 for calling a global function with example usage: _test_type_conversion(device, src_type, in_values, dst_type, out_values, eps) and returns: fn