class_docstr: An function patcher, to patch the un-wrappable operator 'not/is/is not/in/not in' to wrappable functions.
class_docstr_tok: ["An","function","patcher",",","to","patch","the","un-wrappable","operator","'not\/is\/is","not\/in\/not","in","'","to","wrappable","functions","."]
code: def patch_inner_helper(self, func):
      if (
          not hasattr(func, "__module__")
          or func.__module__ is None
          or func.__module__.startswith("torch")
      ):
          return func
      if hasattr(func, "_Patcher__fx_already_patched"):
          return func
      if self.use_operator_patch == (
          func in self.operator_patch_backlist
      ):
          return func
      if _orig_isinstance(func, torch.nn.Module):
          func = func.forward
      if _orig_isinstance(func, MethodType):
          func_inner = func.__func__
          the_self = func.__self__
      else:
          func_inner = func
          the_self = None
      if not _orig_isinstance(func_inner, FunctionType) or not hasattr(
          func_inner, "__code__"
      ):
          return func
  
      lines, lnum = inspect.findsource(func_inner)
      # align with original source code
      source = "".join(("\n" * lnum, *inspect.getblock(lines[lnum:])))
      dedent_src = dedent(source)
      tree = ast.parse(dedent_src)
  
      (
          is_transformed,
          new_tree,
      ) = OperatorPatcher.transformer_op.visit_start(tree)
      if not is_transformed:
          return func
      else:
          body0: ast.FunctionDef = new_tree.body[0]
          body0.body = [
              # equals to:
              # from operator import not_, is_, is_not, contains
              ast.ImportFrom(
                  module="operator",
                  names=[
                      ast.alias(name="not_"),
                      ast.alias(name="is_"),
                      ast.alias(name="is_not"),
                      ast.alias(name="contains"),
                  ],
                  level=0,
              ),
              *body0.body,
          ]
          body0.name = "new_func"
          # for deleting some annotations like 'add_start_docstrings_to_model_forward' or 'add_code_sample_docstrings'
          body0.decorator_list = [
              i
              for i in body0.decorator_list
              if isinstance(i, ast.Call)
              and isinstance(i.func, ast.Name)
              and i.func.id == "patch_run"
              and isinstance(i.args[0], ast.Name)
              and i.args[0].id
              not in (
                  "add_start_docstrings_to_model_forward",
                  "add_code_sample_docstrings",
              )
          ]
          ast.fix_missing_locations(new_tree)
  
          # closure info
          closure_dict = {}
          closures = func_inner.__closure__
          co_freevars = func_inner.__code__.co_freevars
          if (
              closures != None and _orig_len(closures) != 0
          ) or _orig_len(co_freevars) != 0:
              assert _orig_len(closures) == _orig_len(co_freevars)
              closure_dict = _orig_dict(
                  _orig_zip(
                      co_freevars, [c.cell_contents for c in closures]
                  )
              )
  
          tuple_wrapped = tuple
          try:
              if platform.python_version_tuple() < ("3", "9"):
                  setattr(builtins, "tuple", _orig_tuple)
              var_dict = {}
              exec(
                  # use func.__code__.co_filename to make the new function easily debuggable.
                  compile(
                      new_tree, func_inner.__code__.co_filename, "exec"
                  ),
                  {
                      "patch_run": OperatorPatcherContext.patch_run,
                      **func_inner.__globals__,
                      **closure_dict,
                  },
                  var_dict,
              )
              if the_self is not None:
                  return var_dict["new_func"].__get__(the_self)
              else:
                  return var_dict["new_func"]
          finally:
              if platform.python_version_tuple() < ("3", "9"):
                  setattr(builtins, "tuple", tuple_wrapped)
  
imports: from typing import TYPE_CHECKING
  import ast
  import builtins
  import inspect
  import logging
  import platform
  from textwrap import dedent
  from types import MethodType, FunctionType
  from typing import List, Optional, Callable, Dict
  import torch
  from .utils import _orig_type, _orig_isinstance, _orig_len, _orig_dict, _orig_zip, _orig_tuple
label_desc: Use image node_id 3 for calling the OperatorPatcher obj's underlying member method code with example usage: obj.patch_inner_helper(func) and returns: func, func, func, func, func, var_dict, var_dict