class_docstr: Tracer(autowrap_modules=(math,), autowrap_functions=())
  
  ``Tracer`` is the class that implements the symbolic tracing functionality
  of ``torch.fx.symbolic_trace``. A call to ``symbolic_trace(m)`` is equivalent
  to ``Tracer().trace(m)``.
  
  Tracer can be subclassed to override various behaviors of the tracing
  process. The different behaviors that can be overridden are described
  in the docstrings of the methods on this class.
class_docstr_tok: ["Tracer","(","autowrap_modules=","(","math",",",")",",","autowrap_functions=","(",")",")","``","Tracer","``","is","the","class","that","implements","the","symbolic","tracing","functionality","of","``","torch.fx.symbolic_trace","``",".","A","call","to","``","symbolic_trace","(","m",")","``","is","equivalent","to","``","Tracer","(",")",".trace","(","m",")","``",".","Tracer","can","be","subclassed","to","override","various","behaviors","of","the","tracing","process",".","The","different","behaviors","that","can","be","overridden","are","described","in","the","docstrings","of","the","methods","on","this","class","."]
docstr: Method that specifies the behavior of this ``Tracer`` when it encounters
  a call to an ``nn.Module`` instance.
  
  By default, the behavior is to check if the called module is a leaf module
  via ``is_leaf_module``. If it is, emit a ``call_module`` node referring to
  ``m`` in the ``Graph``. Otherwise, call the ``Module`` normally, tracing through
  the operations in its ``forward`` function.
  
  This method can be overridden to--for example--create nested traced
  GraphModules, or any other behavior you would want while tracing across
  ``Module`` boundaries.
  
  Args:
  
      m (Module): The module for which a call is being emitted
      forward (Callable): The forward() method of the ``Module`` to be invoked
      args (Tuple): args of the module callsite
      kwargs (Dict): kwargs of the module callsite
  
  Return:
  
      The return value from the Module call. In the case that a ``call_module``
      node was emitted, this is a ``Proxy`` value. Otherwise, it is whatever
      value was returned from the ``Module`` invocation.
docstr_tok: ["Method","that","specifies","the","behavior","of","this","``","Tracer","``","when","it","encounters","a","call","to","an","``","nn.Module","``","instance",".","By","default",",","the","behavior","is","to","check","if","the","called","module","is","a","leaf","module","via","``","is_leaf_module","``",".","If","it","is",",","emit","a","``","call_module","``","node","referring","to","``","m","``","in","the","``","Graph","``",".","Otherwise",",","call","the","``","Module","``","normally",",","tracing","through","the","operations","in","its","``","forward","``","function",".","This","method","can","be","overridden","to","--","for","example","--","create","nested","traced","GraphModules",",","or","any","other","behavior","you","would","want","while","tracing","across","``","Module","``","boundaries",".","Args",":","m","(","Module",")",":","The","module","for","which","a","call","is","being","emitted","forward","(","Callable",")",":","The","forward","(",")","method","of","the","``","Module","``","to","be","invoked","args","(","Tuple",")",":","args","of","the","module","callsite","kwargs","(","Dict",")",":","kwargs","of","the","module","callsite","Return",":","The","return","value","from","the","Module","call",".","In","the","case","that","a","``","call_module","``","node","was","emitted",",","this","is","a","``","Proxy","``","value",".","Otherwise",",","it","is","whatever","value","was","returned","from","the","``","Module","``","invocation","."]
code: def call_module(
      self,
      m: torch.nn.Module,
      forward: Callable[..., Any],
      args: Tuple[Any, ...],
      kwargs: Dict[str, Any],
  ) -> Any:
      """
      Method that specifies the behavior of this ``Tracer`` when it encounters
      a call to an ``nn.Module`` instance.
  
      By default, the behavior is to check if the called module is a leaf module
      via ``is_leaf_module``. If it is, emit a ``call_module`` node referring to
      ``m`` in the ``Graph``. Otherwise, call the ``Module`` normally, tracing through
      the operations in its ``forward`` function.
  
      This method can be overridden to--for example--create nested traced
      GraphModules, or any other behavior you would want while tracing across
      ``Module`` boundaries.
  
      Args:
  
          m (Module): The module for which a call is being emitted
          forward (Callable): The forward() method of the ``Module`` to be invoked
          args (Tuple): args of the module callsite
          kwargs (Dict): kwargs of the module callsite
  
      Return:
  
          The return value from the Module call. In the case that a ``call_module``
          node was emitted, this is a ``Proxy`` value. Otherwise, it is whatever
          value was returned from the ``Module`` invocation.
      """
      module_qualified_name = self.path_of_module(m)
      with ScopeContextManager(
          self.scope, Scope(module_qualified_name, type(m))
      ) as _scope:
          # module_stack is an ordered dict so writing then deleting the
          # entry is equivalent to push/pop on a list
          self.module_stack[_scope.module_path] = (
              module_qualified_name,
              _scope.module_type,
          )
          if not self.is_leaf_module(m, module_qualified_name):
              ret_val = forward(*args, **kwargs)
          else:
              ret_val = self.create_proxy(
                  "call_module", module_qualified_name, args, kwargs
              )
          key, _ = self.module_stack.popitem(last=True)
          assert key == _scope.module_path, f" Unexpected key {key}"
  
      return ret_val
  
imports: import builtins
  import copy
  import functools
  import inspect
  import math
  import os
  import warnings
  import collections
  from itertools import chain
  from types import CodeType, FunctionType, ModuleType
  from typing import Any, Callable, Dict, List, NamedTuple, Optional, Set, Tuple, Type, Union
  import torch
  import torch.utils._pytree
  from torch._C import ScriptObject
  from ._compatibility import compatibility
  from .graph import _PyTreeCodeGen, _PyTreeInfo, Graph
  from .graph_module import GraphModule
  from .node import Argument, base_types, map_aggregate
  from .proxy import ParameterProxy, Proxy, TracerBase, Scope, ScopeContextManager
label_desc: Use image node_id 5 for calling the Tracer obj's underlying member method code with example usage: obj.call_module(m, forward, args, kwargs) and returns: ret_val