class_docstr: This class is to extract pytorch model topology graph by tracing
class_docstr_tok: ["This","class","is","to","extract","pytorch","model","topology","graph","by","tracing"]
docstr: Parameters
  ----------
  model : pytorch model
      The model user wants to speedup
  dummy_input : pytorch tensor
      The dummy input for ```jit.trace```, users should put it on right device before pass in
  traced_model : torch._C.torch.jit.TopLevelTracedModule
      An alredy traced model, if traced_model is not None, then TorchGraph will build the graph
      based on this traced model and won't trace the model again.
docstr_tok: ["Parameters","--","--","--","--","--","model",":","pytorch","model","The","model","user","wants","to","speedup","dummy_input",":","pytorch","tensor","The","dummy","input","for","``","`","jit.trace","``","`",",","users","should","put","it","on","right","device","before","pass","in","traced_model",":","torch._C.torch.jit.TopLevelTracedModule","An","alredy","traced","model",",","if","traced_model","is","not","None",",","then","TorchGraph","will","build","the","graph","based","on","this","traced","model","and","wo","n't","trace","the","model","again","."]
code: def __init__(self, model=None, dummy_input=None, traced_model=None):
      """
      Parameters
      ----------
      model : pytorch model
          The model user wants to speedup
      dummy_input : pytorch tensor
          The dummy input for ```jit.trace```, users should put it on right device before pass in
      traced_model : torch._C.torch.jit.TopLevelTracedModule
          An alredy traced model, if traced_model is not None, then TorchGraph will build the graph
          based on this traced model and won't trace the model again.
      """
      assert torch.__version__ >= "1.3.1"
      # check if the input is legal
      if traced_model is not None:
          assert isinstance(
              traced_model, torch.jit.TopLevelTracedModule
          ) or isinstance(traced_model, torch.jit.RecursiveScriptModule)
          self.trace = traced_model
          # it's ok if the graph is already unpacked
          torch._C._jit_pass_inline(self.trace.graph)
      elif model is not None and dummy_input is not None:
          self.bound_model = model
          self._trace(model, dummy_input)
      else:
          raise Exception(
              "Please provide model & dummy_input or the traced_model as inputs"
          )
  
imports: import logging
  import queue
  import re
  from collections import defaultdict
  from typing import List, Dict
  import torch
  from torch.utils.tensorboard._pytorch_graph import NodePy, NodePyIO, NodePyOP, GraphPy
label_desc: Use image node_id 1 to create a new TorchGraph object  with example: obj = TorchGraph(model, dummy_input, traced_model)