class_docstr: Trace all indice information for every node.
  
  Indice is a logical concept. Equal dims can been treated as one indice.
  eg. dim(x1) = [a, b, c]
      dim(x2) = [d, e, f]
      and we have x3 = x1 * x2.
      then a=d, b=e, c=f, due to the broadcast property,
      dim(x1)=dim(x2)=dim(x3)=[a, b, c]
  This class will record every node's dims' indice, compute and source.
  
  Attributes:
      node_list (List)
      indice_trace_list (List): [{"indice": [...], "compute": [...], "source": [...]}, {...}]
      indice_view_list (Dict): not used for now
      indice_count (int): record indice number
  
  Args:
      node_list (List)
class_docstr_tok: ["Trace","all","indice","information","for","every","node",".","Indice","is","a","logical","concept",".","Equal","dims","can","been","treated","as","one","indice",".","eg",".","dim","(","x1",")","=","[","a",",","b",",","c","]","dim","(","x2",")","=","[","d",",","e",",","f","]","and","we","have","x3","=","x1","*","x2",".","then","a=d",",","b=e",",","c=f",",","due","to","the","broadcast","property",",","dim","(","x1",")","=dim","(","x2",")","=dim","(","x3",")","=","[","a",",","b",",","c","]","This","class","will","record","every","node","'s","dims","'","indice",",","compute","and","source",".","Attributes",":","node_list","(","List",")","indice_trace_list","(","List",")",":","[","{","``","indice","''",":","[","...","]",",","``","compute","''",":","[","...","]",",","``","source","''",":","[","...","]","}",",","{","...","}","]","indice_view_list","(","Dict",")",":","not","used","for","now","indice_count","(","int",")",":","record","indice","number","Args",":","node_list","(","List",")"]
docstr: clear too far trace to speed up computation
docstr_tok: ["clear","too","far","trace","to","speed","up","computation"]
code: def _clear_trace(self, node_idx: int) -> None:
      """
      clear too far trace to speed up computation
      """
      trace_barrier = max(node_idx - 100, 0)
      active_nodes = self.active_node_list[trace_barrier]
      active_nodes = [
          self.node_mgr.find_node_idx(i) for i in active_nodes.keys()
      ]
  
      trace = self.indice_trace_list[node_idx]
      # clear compute
      for dim_compute in trace["compute"]:
          for i in range(len(dim_compute) - 1, -1, -1):
              if (
                  dim_compute[i] < trace_barrier
                  and dim_compute[i] not in active_nodes
              ):
                  dim_compute.pop(i)
          continue
      # clear source
      for dim_source in trace["source"]:
          for k in list(dim_source.keys()):
              if k < trace_barrier and k not in active_nodes:
                  dim_source.pop(k)
  
imports: import copy
  from typing import Dict, List
  from torch.fx.node import Node
  from .utils import NodeMgr, find_first_tensor_arg, flat_list, get_module_node_name, get_node_name, get_node_shape
label_desc: Use image node_id 43 for calling the TraceIndice obj's underlying member method code with example usage: obj._clear_trace(node_idx) without return types