docstr: Inserts a graph node given target, args, kwargs, and name.
  
  This method can be overridden to do extra checking, validation, or
  modification of values used in node creation. For example, one might
  want to disallow in-place operations from being recorded.
docstr_tok: ["Inserts","a","graph","node","given","target",",","args",",","kwargs",",","and","name",".","This","method","can","be","overridden","to","do","extra","checking",",","validation",",","or","modification","of","values","used","in","node","creation",".","For","example",",","one","might","want","to","disallow","in-place","operations","from","being","recorded","."]
code: def create_node(
      self,
      kind: str,
      target: Target,
      args: Tuple[Argument, ...],
      kwargs: Dict[str, Argument],
      name: Optional[str] = None,
      type_expr: Optional[Any] = None,
  ) -> Node:
      """
      Inserts a graph node given target, args, kwargs, and name.
  
      This method can be overridden to do extra checking, validation, or
      modification of values used in node creation. For example, one might
      want to disallow in-place operations from being recorded.
      """
      if kind == "call_function" and self.check_mutable_operations:
          check_for_mutable_operation(target, args, kwargs)
  
      node = self.graph.create_node(
          kind, target, args, kwargs, name, type_expr
      )
      # TODO node_name_to_scope will be depreciated in favor of
      # node.meta['nn_module_stack']
      self.node_name_to_scope[node.name] = (
          self.scope.module_path,
          self.scope.module_type,
      )
      # Optionally set stack trace on the created Node for debugging purposes
      if fx_traceback.has_preserved_node_meta():
          current_meta: Dict[str, Any] = fx_traceback.get_current_meta()
  
          stack_trace = current_meta.get("stack_trace")
          if stack_trace:
              node.stack_trace = stack_trace
          # Explicitly set the stack_trace, nn_module_stack and source_fn on the node.meta
          # If other meta fields are needed, they can be added here
          for field in _COPY_META_FIELDS:
              if field in current_meta:
                  node.meta[field] = copy.copy(current_meta[field])
  
          # Here we decrement to account for the sequence_nr having
          # just been incremented while tracing this lowered aten op.
          new_seq_nr = torch.autograd._get_sequence_nr() - 1
          # The sequence_nr increments every time a new autograd Node
          # is created. During the FWD pass we store the sequence_nr
          # corresponding to the last autograd Node created on this fx
          # node's meta.  A single aten op can create multiple autograd
          # nodes as is the case with in-place foreach ops. During the
          # BWD pass we retrieve the sequence_nr stored on the current
          # executing autograd Node. See NOTE [ Sequence Number ].
          if current_meta.get("in_grad_fn", False):
              new_seq_nr = current_meta["grad_fn_seq_nr"]
          node.meta["seq_nr"] = new_seq_nr
  
      elif self.module_stack:
          node.meta["nn_module_stack"] = copy.copy(self.module_stack)
      return node
  
imports: import enum
  import dis
  import copy
  import sys
  import torch
  import inspect
  import operator
  import traceback
  import collections
  from dataclasses import is_dataclass, fields
  from .graph import magic_methods, reflectable_magic_methods, Graph
  from typing import Tuple, Dict, OrderedDict, Optional, Any, Iterator, Callable
  from .node import Target, Node, Argument, base_types, map_aggregate
  from ._compatibility import compatibility
  from .operator_schemas import check_for_mutable_operation
  import torch.fx.traceback
label_desc: Use image node_id 1 for calling the TracerBase obj's underlying member method code with example usage: obj.create_node(kind, target, args, kwargs, name, type_expr) and returns: node