code: def check_pad(
      device,
      batch_size,
      input_max_shape,
      axes,
      axis_names,
      align,
      shape_arg,
  ):
      eii = RandomlyShapedDataIterator(
          batch_size, max_shape=input_max_shape
      )
      layout = "HWC"
      pipe = PadSynthDataPipeline(
          device,
          batch_size,
          iter(eii),
          axes=axes,
          axis_names=axis_names,
          align=align,
          shape_arg=shape_arg,
          layout=layout,
      )
      pipe.build()
  
      if axis_names:
          axes = []
          for axis_name in axis_names:
              axis_idx = layout.find(axis_name)
              assert axis_idx >= 0
              axes.append(axis_idx)
  
      actual_axes = (
          axes
          if (axes and len(axes) > 0)
          else range(len(input_max_shape))
      )
      assert len(actual_axes) > 0
  
      if not shape_arg or len(shape_arg) == 0:
          shape_arg = [-1] * len(actual_axes)
      assert len(shape_arg) == len(actual_axes)
  
      if not align or len(align) == 0:
          align = [1] * len(actual_axes)
      elif len(align) == 1 and len(actual_axes) > 1:
          align = [align[0] for _ in actual_axes]
      assert len(align) == len(actual_axes)
  
      for k in range(5):
          out1, out2 = pipe.run()
  
          out1_data = (
              out1.as_cpu()
              if isinstance(out1[0], dali.backend_impl.TensorGPU)
              else out1
          )
          max_shape = [-1] * len(input_max_shape)
  
          for i in range(len(actual_axes)):
              dim = actual_axes[i]
              align_val = align[i]
              shape_arg_val = shape_arg[i]
              for i in range(batch_size):
                  input_shape = out1_data.at(i).shape
                  if input_shape[dim] > max_shape[dim]:
                      max_shape[dim] = input_shape[dim]
  
          out2_data = (
              out2.as_cpu()
              if isinstance(out2[0], dali.backend_impl.TensorGPU)
              else out2
          )
          for i in range(batch_size):
              input_shape = out1_data.at(i).shape
              output_shape = out2_data.at(i).shape
  
              for j in range(len(actual_axes)):
                  dim = actual_axes[j]
                  align_val = align[j]
                  shape_arg_val = shape_arg[j]
                  if shape_arg_val >= 0:
                      in_extent = input_shape[dim]
                      expected_extent = (
                          in_extent
                          if in_extent > shape_arg_val
                          else shape_arg_val
                      )
                  else:
                      expected_extent = max_shape[dim]
                  remainder = expected_extent % align_val
                  if remainder > 0:
                      expected_extent = (
                          expected_extent - remainder + align_val
                      )
                  assert output_shape[dim] == expected_extent
  
imports: import numpy
  import nvidia.dali
  import nvidia.dali.fn
  import nvidia.dali.math
  import nvidia.dali.ops
  import nvidia.dali.types
  from nvidia.dali import Pipeline, pipeline_def
  from nvidia.dali.backend_impl import TensorListGPU
  from nose_utils import assert_raises
  from test_utils import RandomlyShapedDataIterator, generator_random_axes_for_3d_input, generator_random_data, as_array
label_desc: Use image node_id 1 for calling a global function with example usage: check_pad(device, batch_size, input_max_shape, axes, axis_names, align, shape_arg) without return types