class_docstr: Class for custom operators in PyTorch.
  
  Use the CustomOp API to create user-defined custom operators that behave
  just like regular PyTorch operators (e.g. torch.sin, torch.mm) when it
  comes to various PyTorch subsystems (like torch.compile).
  
  To construct a `CustomOp`, use `custom_op`.
code: def __init__(
      self,
      lib,
      cpp_ns,
      schema,
      operator_name,
      ophandle,
      *,
      _private_access=False,
  ):
      super().__init__()
      if not _private_access:
          raise RuntimeError(
              "The CustomOp constructor is private and we do not guarantee "
              "BC for it. Please use custom_op(...) to create a CustomOp object"
          )
      name = f"{cpp_ns}::{operator_name}"
      self._schema = schema
      self._cpp_ns = cpp_ns
      self._lib: library.Library = lib
      self._ophandle: _C._DispatchOperatorHandle = ophandle
      # Has the name of the op, e.g. "foo". We cache here for convenience.
      self._opname: str = operator_name
      # this is _opname but with namespace. e.g. "custom::foo"
      self._qualname: str = name
      self.__name__ = None  # mypy requires this
      # NB: Some of these impls are registered as kernels to DispatchKeys.
      # Modifying the _impls dict directly won't do anything in that case.
      self._impls: typing.Dict[
          str, typing.Optional[FuncAndLocation]
      ] = {}
      # See NOTE [CustomOp autograd kernel indirection]
      self._registered_autograd_kernel_indirection = False
  
      global_registry[self._qualname] = self
  
imports: import dataclasses
  import functools
  import inspect
  import sys
  import typing
  import weakref
  from torchgen.model import FunctionSchema, OperatorName, SchemaKind, BaseType, ListType, BaseTy
  import torch
  import torch._C
  import torch.library
  from torch._library.abstract_impl import AbstractImplCtx
  from torch.library import get_ctx
  from .autograd import autograd_kernel_indirection, construct_autograd_kernel
label_desc: Use image node_id 1 to create a new CustomOp object  with example: obj = CustomOp(lib, cpp_ns, schema, operator_name, ophandle)