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: "")
docstr: Defines a new operator and its semantics in the ns namespace.
  
  Args:
      schema: function schema to define a new operator.
      alias_analysis (optional): Indicates if the aliasing properties of the operator arguments can be
                                 inferred from the schema (default behavior) or not ("CONSERVATIVE").
      tags (Tag | Sequence[Tag]): one or more torch.Tag to apply to this
                                 operator. Tagging an operator changes the operator's behavior
                                 under various PyTorch subsystems; please read the docs for the
                                 torch.Tag carefully before applying it.
  
  Returns:
      name of the operator as inferred from the schema.
  
  Example::
      >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_LIBRARY)
      >>> my_lib = Library("foo", "DEF")
      >>> my_lib.define("sum(Tensor self) -> Tensor")
docstr_tok: ["Defines","a","new","operator","and","its","semantics","in","the","ns","namespace",".","Args",":","schema",":","function","schema","to","define","a","new","operator",".","alias_analysis","(","optional",")",":","Indicates","if","the","aliasing","properties","of","the","operator","arguments","can","be","inferred","from","the","schema","(","default","behavior",")","or","not","(","``","CONSERVATIVE","''",")",".","tags","(","Tag","|","Sequence","[","Tag","]",")",":","one","or","more","torch.Tag","to","apply","to","this","operator",".","Tagging","an","operator","changes","the","operator","'s","behavior","under","various","PyTorch","subsystems",";","please","read","the","docs","for","the","torch.Tag","carefully","before","applying","it",".","Returns",":","name","of","the","operator","as","inferred","from","the","schema",".","Example",":",":",">",">",">","#","xdoctest",":","+REQUIRES","(","env",":","TORCH_DOCTEST_LIBRARY",")",">",">",">","my_lib","=","Library","(","``","foo","''",",","``","DEF","''",")",">",">",">","my_lib.define","(","``","sum","(","Tensor","self",")","-",">","Tensor","''",")"]
code: def define(self, schema, alias_analysis="", *, tags=()):
      r"""Defines a new operator and its semantics in the ns namespace.
  
      Args:
          schema: function schema to define a new operator.
          alias_analysis (optional): Indicates if the aliasing properties of the operator arguments can be
                                     inferred from the schema (default behavior) or not ("CONSERVATIVE").
          tags (Tag | Sequence[Tag]): one or more torch.Tag to apply to this
                                     operator. Tagging an operator changes the operator's behavior
                                     under various PyTorch subsystems; please read the docs for the
                                     torch.Tag carefully before applying it.
  
      Returns:
          name of the operator as inferred from the schema.
  
      Example::
          >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_LIBRARY)
          >>> my_lib = Library("foo", "DEF")
          >>> my_lib.define("sum(Tensor self) -> Tensor")
      """
      # This is added because we also want to disallow PURE_FUNCTION alias analysis which is a valid
      # AliasAnalysis type in C++
      if alias_analysis not in ["", "FROM_SCHEMA", "CONSERVATIVE"]:
          raise RuntimeError(
              f"Invalid alias_analysis type {alias_analysis}"
          )
      assert self.m is not None
      if isinstance(tags, torch.Tag):
          tags = (tags,)
      result = self.m.define(schema, alias_analysis, tuple(tags))
      qualname = self.ns + "::" + schema.split("(")[0]
      self._op_defs.add(qualname)
      _defs.add(qualname)
      return result
  
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 3 for calling the Library obj's underlying member method code with example usage: obj.define(schema, alias_analysis) and returns: result