class_docstr: For a given test, OpCheckMode intercepts calls to operators and runs
  test_util(op, args, kwargs) for each intercepted (op, args, kwargs).
code: def maybe_raise_errors_on_exit(self) -> None:
      # Check expected failures first
      for qualname in self.seen_ops_to_errors.keys():
          option = self.failures_dict.get_status(
              qualname, self.test_name
          )
          if len(self.seen_ops_to_errors[qualname]) == 0:
              if should_update_failures_dict():
                  self.failures_dict.set_status(
                      qualname, self.test_name, "xsuccess", comment=""
                  )
              else:
                  if option == "xfail":
                      raise OpCheckError(
                          f"generate_opcheck_tests: Unexpected success for operator "
                          f"{qualname} on test {self.test_name}. This may mean that "
                          f"you have fixed this test failure. Please rerun the test with "
                          f"PYTORCH_OPCHECK_ACCEPT=1 to automatically update the test runner "
                          f"or manually remove the "
                          f"expected failure in the failure dict at "
                          f"{self.failures_dict_path}"
                          f"For more details, see "
                          f"{GDOC}"
                      )
              continue
      failed_ops = []
      for qualname in self.seen_ops_to_errors.keys():
          option = self.failures_dict.get_status(
              qualname, self.test_name
          )
          if option != "xsuccess":
              continue
          if len(self.seen_ops_to_errors[qualname]) == 0:
              continue
          failed_ops.append(qualname)
      if not failed_ops:
          return
  
      if should_update_failures_dict():
          for op in failed_ops:
              self.failures_dict.set_status(op, self.test_name, "xfail")
          return
  
      # Raise from the first error but also report about all of them to make
      # recording xfails easier.
      ex, op, args, kwargs = self.seen_ops_to_errors[failed_ops[0]][0]
      repro_command = generate_repro(
          self.test_util_name,
          op,
          args,
          kwargs,
          save_data=should_print_better_repro(),
      )
      raise OpCheckError(
          f"Test generated by `generate_opcheck_tests`, {self.test_name}, "
          f"failed on operators {failed_ops}. This usually means that the "
          f"operators are not implemented correctly and may lead to silently "
          f"incorrect behavior. Set PYTORCH_OPCHECK_PRINT_BETTER_REPRO=1 for a standalone repro, "
          f"or please see "
          f"{GDOC} "
          f"for more recommendations. "
          f"To reproduce this problem locally, try to run the following:\n{repro_command}"
      ) from ex
  
imports: import datetime
  import difflib
  import functools
  import inspect
  import json
  import os
  import re
  import tempfile
  import threading
  import unittest
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import torch
  import torch._dynamo
  import torch.utils._pytree
  from torch._dynamo.utils import clone_input
  from torch._subclasses.schema_check_mode import SchemaCheckMode
  from torch._utils_internal import get_file_path_2
  from torch.overrides import TorchFunctionMode
  from torch.testing._internal.optests import aot_autograd_check, autograd_registration_check, fake_check
label_desc: Use image node_id 2 for calling the OpCheckMode obj's underlying member method code with example usage: obj.maybe_raise_errors_on_exit() without return types