class_docstr: A class to create libraries that can be used to register new operators or
  override operators in existing libraries from Python.
  A user can optionally pass in a dispatch keyname if they only want to register
  kernels corresponding to only one specific dispatch key.
  
  To create a library to override operators in an existing library (with name ns), set the kind to "IMPL".
  To create a new library (with name ns) to register new operators, set the kind to "DEF".
  To create a fragment of a possibly existing library to register operators (and bypass
  the limitation that there is only one library for a given namespace), set the kind to
  "FRAGMENT".
  
  Args:
      ns: library name
      kind: "DEF", "IMPL" (default: "IMPL"), "FRAGMENT"
      dispatch_key: PyTorch dispatch key (default: "")
code: def __init__(self, ns, kind, dispatch_key=""):
      if kind not in ("IMPL", "DEF", "FRAGMENT"):
          raise ValueError("Unsupported kind: ", kind)
  
      if ns in _reserved_namespaces and (
          kind == "DEF" or kind == "FRAGMENT"
      ):
          raise ValueError(
              ns,
              " is a reserved namespace. Please try creating a library with another name.",
          )
  
      frame = traceback.extract_stack(limit=3)[0]
      filename, lineno = frame.filename, frame.lineno
      self.m: Optional[Any] = torch._C._dispatch_library(
          kind, ns, dispatch_key, filename, lineno
      )
      self.ns = ns
      self._op_defs: Set[str] = set()
      self._op_impls: Set[str] = set()
      self._registration_handles: List[
          "torch._library.utils.RegistrationHandle"
      ] = []
      self.kind = kind
      self.dispatch_key = dispatch_key
      # Use a finalizer to setup the "destructor" instead of __del__.
      # Python __del__ can lead to weird things (globals and locals may already
      # be gone when __del__ actually gets called!). finalizers help the
      # situation because it lets us capture references and keeps them alive
      weakref.finalize(
          self,
          _del_library,
          _impls,
          self._op_impls,
          _defs,
          self._op_defs,
          self._registration_handles,
      )
  
imports: from ._ops import OpOverload
  from typing import Any, Optional, Set, List
  import traceback
  import torch
  import weakref
  import functools
  import inspect
  import re
  import sys
label_desc: Use image node_id 1 to create a new Library object  with example: obj = Library(ns, kind, dispatch_key)