code: def _testimpl_operator_noise_shot(device, factor, batch_size, niter):
      pipe = pipe_shot_noise(
          factor,
          device=device,
          batch_size=batch_size,
          num_threads=3,
          device_id=0,
          seed=12345,
      )
      pipe.build()
      for _ in range(niter):
          out_data, in_data, factor_arg = pipe.run()
          factor_arg = factor_arg.as_array()
          if device == "gpu":
              out_data = out_data.as_cpu()
              in_data = in_data.as_cpu()
          for s in range(batch_size):
              sample_in = np.array(out_data[s])
              sample_out = np.array(in_data[s])
              factor = factor_arg[s]
              sample_ref = shot_noise_ref(sample_in, factor)
              psnr_out = PSNR(sample_out, sample_in)
              psnr_ref = PSNR(sample_ref, sample_in)
              np.testing.assert_allclose(psnr_out, psnr_ref, atol=1)
              if dump_images:
                  import cv2
  
                  cv2.imwrite(
                      f"./shotnoise_ref_p{factor}_s{s}.png",
                      cv2.cvtColor(sample_ref, cv2.COLOR_BGR2RGB),
                  )
                  cv2.imwrite(
                      f"./shotnoise_out_p{factor}_s{s}.png",
                      cv2.cvtColor(sample_out, cv2.COLOR_BGR2RGB),
                  )
  
file_path: DALI/dali/test/python/operator_1/test_noise_shot.py
imports: from nvidia.dali import pipeline_def
  import nvidia.dali.fn
  import nvidia.dali.types
  import random
  import numpy
  import os
  from test_utils import get_dali_extra_path
  from test_noise_utils import PSNR
label_desc: Use image node_id 3 for calling a global function with example usage: _testimpl_operator_noise_shot(device, factor, batch_size, niter) without return types