code: def check_per_sample_laplacian(
      device,
      batch_size,
      window_dim,
      smoothing_dim,
      normalize,
      shape,
      layout,
      axes,
      in_type,
      out_type,
  ):
      iterator = RandomlyShapedDataIterator(
          batch_size, max_shape=shape, dtype=in_type
      )
  
      pipe = laplacian_per_sample_pipeline(
          device_id=0,
          device=device,
          num_threads=4,
          batch_size=batch_size,
          seed=42,
          iterator=iterator,
          layout=layout,
          window_dim=window_dim,
          smoothing_dim=smoothing_dim,
          axes=axes,
          normalize=normalize,
          out_type=out_type,
      )
      pipe.build()
  
      for _ in range(test_iters):
          edges, data, window_size, smoothing_size, scale = pipe.run()
          if device == "gpu":
              edges = edges.as_cpu()
              data = data.as_cpu()
          edges, data, window_size, smoothing_size, scale = [
              to_batch(out, batch_size)
              for out in (
                  edges,
                  data,
                  window_size,
                  smoothing_size,
                  scale,
              )
          ]
          baseline = []
          for i in range(batch_size):
              skip_axes = count_skip_axes(layout)
              sample_baseline = laplacian_baseline(
                  data[i],
                  out_type or in_type,
                  window_size[i],
                  smoothing_size[i],
                  scale[i],
                  axes,
                  skip_axes,
              )
              baseline.append(sample_baseline)
          if out_type == np.float32:
              # Normalized abs values are up to 2 * `axes` * 255 so it still gives
              # over 5 decimal digits of precision
              max_error = 1e-3
          else:
              max_error = 1
          check_batch(
              edges,
              baseline,
              batch_size,
              max_allowed_error=max_error,
              expected_layout=layout,
          )
  
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 20 for calling a global function with example usage: check_per_sample_laplacian(device, batch_size, window_dim, smoothing_dim, normalize, shape, layout, axes, in_type, out_type) without return types