code: def laplacian_per_sample_pipeline(
      device,
      iterator,
      layout,
      window_dim,
      smoothing_dim,
      axes,
      normalize,
      out_type,
  ):
      data = fn.external_source(iterator, layout=layout)
      if window_dim is None:
          window_size = 3
          w_exponent = 0
          window_arg = None
      else:
          window_shape = [axes for _ in range(window_dim)]
          window_size = (
              fn.random.uniform(
                  range=[1, max_window_size // 2],
                  shape=window_shape,
                  dtype=types.INT32,
              )
              * 2
              + 1
          )
          window_arg = window_size
          w_exponent = window_size - 3
  
      if smoothing_dim is None:
          smoothing_size = None
          s_exponent = (window_size - 1) * (axes - 1)
      else:
          smoothing_shape = [axes for _ in range(smoothing_dim)]
          smoothing_size = (
              fn.random.uniform(
                  range=[0, max_window_size // 2],
                  shape=smoothing_shape,
                  dtype=types.INT32,
              )
              * 2
              + 1
          )
          if smoothing_dim == 1:
              s_exponent = (
                  fn.reductions.sum(smoothing_size, axes=0)
                  - smoothing_size
                  - axes
                  + 1
              )
          else:
              s_exponent = (smoothing_size - 1) * (axes - 1)
  
      exponent = w_exponent + s_exponent
      scale = 2.0 ** (-exponent)
      kwargs = (
          {"normalized_kernel": True} if normalize else {"scale": scale}
      )
  
      if out_type == np.float32:
          kwargs["dtype"] = types.FLOAT
  
      if device == "gpu":
          data = data.gpu()
      edges = fn.laplacian(
          data,
          window_size=window_arg,
          device=device,
          smoothing_size=smoothing_size,
          **kwargs,
      )
  
      if smoothing_size is None:
          smoothing_size = np.array([], dtype=np.int32)
      if window_arg is None:
          window_arg = np.array([], dtype=np.int32)
      return edges, data, window_arg, smoothing_size, scale
  
imports: from nvidia.dali.pipeline import pipeline_def
  import nvidia.dali.types
  import nvidia.dali.fn
  import numpy
  import cv2
  from scipy.ndimage import convolve1d, filters
  import os
  from nose_utils import assert_raises
  from nose.plugins.attrib import attr
  from sequences_test_utils import video_suite_helper, ArgCb
  from test_utils import get_dali_extra_path, check_batch, RandomlyShapedDataIterator
label_desc: Use image node_id 19 for calling a global function with example usage: laplacian_per_sample_pipeline(device, iterator, layout, window_dim, smoothing_dim, axes, normalize, out_type) and returns: edges,  data,  window_arg,  smoothing_size,  scale