code: def pipe_salt_and_pepper_noise(
      prob,
      salt_vs_pepper,
      channel_first,
      per_channel,
      salt_val,
      pepper_val,
      device="cpu",
  ):
      encoded, _ = fn.readers.file(file_root=images_dir)
      in_data = fn.decoders.image(encoded, output_type=types.RGB)
      if device == "gpu":
          in_data = in_data.gpu()
      if channel_first:
          in_data = fn.transpose(in_data, perm=[2, 0, 1])
      prob_arg = prob or fn.random.uniform(range=(0.05, 0.5))
      salt_vs_pepper_arg = salt_vs_pepper or fn.random.uniform(
          range=(0.25, 0.75)
      )
      out_data = fn.noise.salt_and_pepper(
          in_data,
          per_channel=per_channel,
          prob=prob_arg,
          salt_vs_pepper=salt_vs_pepper_arg,
          salt_val=salt_val,
          pepper_val=pepper_val,
      )
      return in_data, out_data, prob_arg, salt_vs_pepper_arg
  
file_path: DALI/dali/test/python/operator_1/test_noise_salt_and_pepper.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 2 for calling a global function with example usage: pipe_salt_and_pepper_noise(prob, salt_vs_pepper, channel_first, per_channel, salt_val, pepper_val, device) and returns: in_data,  out_data,  prob_arg,  salt_vs_pepper_arg