docstr: Compare decoding results from two sources.
  Args:
      tv_result: decoding results from TorchVision decoder
      ref_result: reference decoding results which can be from either PyAv
                  decoder or TorchVision decoder with getPtsOnly = 1
      config: config of decoding results checker
docstr_tok: ["Compare","decoding","results","from","two","sources",".","Args",":","tv_result",":","decoding","results","from","TorchVision","decoder","ref_result",":","reference","decoding","results","which","can","be","from","either","PyAv","decoder","or","TorchVision","decoder","with","getPtsOnly","=","1","config",":","config","of","decoding","results","checker"]
code: def compare_decoding_result(
      self, tv_result, ref_result, config=all_check_config
  ):
      """
      Compare decoding results from two sources.
      Args:
          tv_result: decoding results from TorchVision decoder
          ref_result: reference decoding results which can be from either PyAv
                      decoder or TorchVision decoder with getPtsOnly = 1
          config: config of decoding results checker
      """
      (
          vframes,
          vframe_pts,
          vtimebase,
          _vfps,
          _vduration,
          aframes,
          aframe_pts,
          atimebase,
          _asample_rate,
          _aduration,
      ) = tv_result
      if isinstance(ref_result, list):
          # the ref_result is from new video_reader decoder
          ref_result = DecoderResult(
              vframes=ref_result[0],
              vframe_pts=ref_result[1],
              vtimebase=ref_result[2],
              aframes=ref_result[5],
              aframe_pts=ref_result[6],
              atimebase=ref_result[7],
          )
  
      if vframes.numel() > 0 and ref_result.vframes.numel() > 0:
          mean_delta = torch.mean(
              torch.abs(vframes.float() - ref_result.vframes.float())
          )
          assert mean_delta == approx(0.0, abs=8.0)
  
      mean_delta = torch.mean(
          torch.abs(vframe_pts.float() - ref_result.vframe_pts.float())
      )
      assert mean_delta == approx(0.0, abs=1.0)
  
      assert_equal(vtimebase, ref_result.vtimebase)
  
      if (
          config.check_aframes
          and aframes.numel() > 0
          and ref_result.aframes.numel() > 0
      ):
          """Audio stream is available and audio frame is required to return
          from decoder"""
          assert_equal(aframes, ref_result.aframes)
  
      if (
          config.check_aframe_pts
          and aframe_pts.numel() > 0
          and ref_result.aframe_pts.numel() > 0
      ):
          """Audio stream is available"""
          assert_equal(aframe_pts, ref_result.aframe_pts)
  
          assert_equal(atimebase, ref_result.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 the TestVideoReader obj's underlying member method code with example usage: obj.compare_decoding_result(tv_result, ref_result, config) without return types