code: def test_video_input_partial_vs_pad(
      device, frames_per_sequence, batch_size, test_video
  ):
      input_name = "VIDEO_INPUT"
      partial_pipe = video_input_pipeline(
          input_name=input_name,
          batch_size=batch_size,
          sequence_length=frames_per_sequence,
          device=device,
          last_sequence_policy="partial",
          **common_pipeline_params,
      )
      pad_pipe = video_input_pipeline(
          input_name=input_name,
          batch_size=batch_size,
          sequence_length=frames_per_sequence,
          device=device,
          last_sequence_policy="pad",
          **common_pipeline_params,
      )
  
      num_frames = get_num_frames(test_video)
  
      partial_pipe.build()
      partial_pipe.feed_input(input_name, np.array([[test_video]]))
      pad_pipe.build()
      pad_pipe.feed_input(input_name, np.array([[test_video]]))
  
      (
          num_iterations,
          num_full_sequences,
          num_frames_in_partial_sequence,
      ) = get_batch_outline(num_frames, frames_per_sequence, batch_size)
  
      # First, check all the full batches with full sequences
      for _ in range(num_iterations):
          out1 = partial_pipe.run()
          out2 = pad_pipe.run()
          np.testing.assert_array_equal(
              to_array(out1[0]), to_array(out2[0])
          )
  
      if (
          num_frames - num_iterations * frames_per_sequence * batch_size
          == 0
      ):
          # Frames have been split equally across batches.
          return
  
      # Now check the full sequences in the last batch
      partial_out = partial_pipe.run()[0]
      pad_out = pad_pipe.run()[0]
      for i in range(num_full_sequences):
          np.testing.assert_array_equal(
              to_array(partial_out[i]), to_array(pad_out[i])
          )
  
      # And lastly, the actual check PARTIAL vs PAD -
      # the last sequence in the last batch, which might be partial (or padded).
      if num_frames_in_partial_sequence == 0:
          return
      last_partial_sequence = to_array(partial_out[num_full_sequences])
      last_pad_sequence = to_array(pad_out[num_full_sequences])
      for i in range(num_frames_in_partial_sequence):
          # The frames that are in both - partial and padded sequences.
          np.testing.assert_array_equal(
              last_partial_sequence[i], last_pad_sequence[i]
          )
      frame_shape = last_pad_sequence[0].shape
      empty_frame = np.zeros(frame_shape, dtype=np.uint8)
      for i in range(
          num_frames_in_partial_sequence, frames_per_sequence
      ):
          # The frames that are only in padded sequence.
          np.testing.assert_array_equal(
              last_pad_sequence[i], empty_frame
          )
  
file_path: DALI/dali/test/python/input/test_video.py
imports: import glob
  import itertools
  import numpy
  import nvidia.dali.fn
  import nvidia.dali.types
  from nose2.tools import params
  from nose_utils import assert_raises
  from nvidia.dali import pipeline_def
  from test_utils import get_dali_extra_path, to_array
label_desc: Use image node_id 8 for calling a global function with example usage: test_video_input_partial_vs_pad(device, frames_per_sequence, batch_size, test_video) without return types