code: def _decode_frames_by_av_module(
      full_path,
      video_start_pts=0,
      video_end_pts=None,
      audio_start_pts=0,
      audio_end_pts=None,
  ):
      """
      Use PyAv to decode video frames. This provides a reference for our decoder
      to compare the decoding results.
      Input arguments:
          full_path: video file path
          video_start_pts/video_end_pts: the starting/ending Presentation TimeStamp where
              frames are read
      """
      if video_end_pts is None:
          video_end_pts = float("inf")
      if audio_end_pts is None:
          audio_end_pts = float("inf")
      container = av.open(full_path)
  
      video_frames = []
      vtimebase = torch.zeros([0], dtype=torch.int32)
      if container.streams.video:
          video_frames = _read_from_stream(
              container,
              video_start_pts,
              video_end_pts,
              container.streams.video[0],
              {"video": 0},
          )
          # container.streams.video[0].average_rate is not a reliable estimator of
          # frame rate. It can be wrong for certain codec, such as VP80
          # So we do not return video fps here
          vtimebase = _fraction_to_tensor(
              container.streams.video[0].time_base
          )
  
      audio_frames = []
      atimebase = torch.zeros([0], dtype=torch.int32)
      if container.streams.audio:
          audio_frames = _read_from_stream(
              container,
              audio_start_pts,
              audio_end_pts,
              container.streams.audio[0],
              {"audio": 0},
          )
          atimebase = _fraction_to_tensor(
              container.streams.audio[0].time_base
          )
  
      container.close()
      vframes = [frame.to_rgb().to_ndarray() for frame in video_frames]
      vframes = torch.as_tensor(np.stack(vframes))
  
      vframe_pts = torch.tensor(
          [frame.pts for frame in video_frames], dtype=torch.int64
      )
  
      aframes = [frame.to_ndarray() for frame in audio_frames]
      if aframes:
          aframes = np.transpose(np.concatenate(aframes, axis=1))
          aframes = torch.as_tensor(aframes)
      else:
          aframes = torch.empty((1, 0), dtype=torch.float32)
  
      aframe_pts = torch.tensor(
          [audio_frame.pts for audio_frame in audio_frames],
          dtype=torch.int64,
      )
  
      return DecoderResult(
          vframes=vframes,
          vframe_pts=vframe_pts,
          vtimebase=vtimebase,
          aframes=aframes,
          aframe_pts=aframe_pts,
          atimebase=atimebase,
      )
  
imports: import collections
  import math
  import os
  from fractions import Fraction
  import numpy
  import pytest
  import torch
  import torchvision.io
  from common_utils import assert_equal
  from numpy.random import randint
  from pytest import approx
  from torchvision import set_video_backend
  from torchvision.io import _HAS_VIDEO_OPT
label_desc: Use image node_id 4 for calling a global function with example usage: _decode_frames_by_av_module(full_path, video_start_pts, video_end_pts, audio_start_pts, audio_end_pts) and returns: DecoderResult