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: Assign indice for getitem.
  getitem can act like slice sometimes
  
  Args:
      node (node)
      node_idx (int)
docstr_tok: ["Assign","indice","for","getitem",".","getitem","can","act","like","slice","sometimes","Args",":","node","(","node",")","node_idx","(","int",")"]
code: def _assign_getitem_indice(self, node: Node, node_idx: int) -> None:
      """
      Assign indice for getitem.
      getitem can act like slice sometimes
  
      Args:
          node (node)
          node_idx (int)
      """
      node_args = flat_list(node.args[1:])
  
      # deal with split
      if get_node_name(node.args[0]) == "split":
          self._assign_indice_as_input(node, node_idx)
          self._del_dim(node_idx, node.args[0].kwargs["dim"])
          self._add_dim(node_idx, node.args[0].kwargs["dim"])
          return
  
      # skip non tensor
      if get_node_shape(node) is None:
          return
  
      # find if slice
      flag = False
      for node_arg in node_args:
          node_arg_str = str(node_arg)
          if any(i == node_arg_str for i in ["None", "Ellipsis"]):
              flag = True
              break
          if "slice" in node_arg_str:
              flag = True
              break
      if flag == False:
          return
  
      # node args should be like [Ellipsis, slice(start, step, end), None]
      node_shape = get_node_shape(node)
      origin_idx_count = 0
      new_idx_count = 0
      new_dim_num = sum(
          [1 if str(i) == "None" else 0 for i in node_args]
      )
      for _ in range(new_dim_num):
          self._del_dim(node_idx, 0)
      delete_dim_num = sum(
          [1 if str(i) == "0" else 0 for i in node_args]
      )
      for _ in range(delete_dim_num):
          self._add_dim(node_idx, 0)
      self._assign_indice_as_input(node, node_idx)
  
      for _, node_arg in enumerate(node_args):
          node_arg_str = str(node_arg)
          # Ellipsis means [..., ]
          if "Ellipsis" == node_arg_str:
              shape_gap = len(node_shape) - len(node_args) + 1
              origin_idx_count += shape_gap
              new_idx_count += shape_gap
          # slice(None, None, None) means all indexes
          elif "slice" in node_arg_str:
              if "slice(None, None, None)" != node_arg_str:
                  self._del_dim(node_idx, new_idx_count)
                  self._add_dim(node_idx, new_idx_count)
              origin_idx_count += 1
              new_idx_count += 1
          # None means a new dim
          elif "None" == node_arg_str:
              self._add_dim(node_idx, new_idx_count)
              new_idx_count += 1
          elif "0" == node_arg_str:
              self._del_dim(node_idx, new_idx_count)
              origin_idx_count += 1
          else:
              raise NotImplementedError()
  
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 41 for calling the TraceIndice obj's underlying member method code with example usage: obj._assign_getitem_indice(node, node_idx) without return types