code: def parse(self, nodelists):  # noqa: C901
      total_duration = 0.0
      weighted_occupancy = 0.0
      weighted_sm_efficiency = 0.0
      for threadid, nodes in nodelists.items():
          for node in nodes:
              if node.type == "Operator":
                  op_name = node.name
                  for children in node.children_node:
                      if children.type == "OperatorInner":
                          for runtime_node in children.runtime_node:
                              for (
                                  device_node
                              ) in runtime_node.device_node:
                                  if device_node.type == "Kernel":
                                      op_attribute_name = self._translate_op_name_attributes_to_string(
                                          op_name, device_node
                                      )
                                      if (
                                          op_attribute_name
                                          not in self.kernel_items_with_op_name_attributes[
                                              device_node.name
                                          ]
                                      ):
                                          self.kernel_items_with_op_name_attributes[
                                              device_node.name
                                          ][
                                              op_attribute_name
                                          ] = DeviceItem(
                                              device_node.name
                                          )
                                      self.kernel_items_with_op_name_attributes[
                                          device_node.name
                                      ][
                                          op_attribute_name
                                      ].add_item(
                                          device_node
                                      )
                  for runtime_node in node.runtime_node:
                      for device_node in runtime_node.device_node:
                          if device_node.type == "Kernel":
                              op_attribute_name = self._translate_op_name_attributes_to_string(
                                  op_name, device_node
                              )
                              if (
                                  op_attribute_name
                                  not in self.kernel_items_with_op_name_attributes[
                                      device_node.name
                                  ]
                              ):
                                  self.kernel_items_with_op_name_attributes[
                                      device_node.name
                                  ][
                                      op_attribute_name
                                  ] = DeviceItem(
                                      device_node.name
                                  )
                              self.kernel_items_with_op_name_attributes[
                                  device_node.name
                              ][op_attribute_name].add_item(device_node)
              elif node.type == "OperatorInner":
                  continue
              op_name = node.name
              for runtime_node in node.runtime_node:
                  for device_node in runtime_node.device_node:
                      if device_node.type == "Kernel":
                          op_attribute_name = self._translate_op_name_attributes_to_string(
                              op_name, device_node
                          )
                          if (
                              op_attribute_name
                              not in self.kernel_items_with_op_name_attributes[
                                  device_node.name
                              ]
                          ):
                              self.kernel_items_with_op_name_attributes[
                                  device_node.name
                              ][op_attribute_name] = DeviceItem(
                                  device_node.name
                              )
                          self.kernel_items_with_op_name_attributes[
                              device_node.name
                          ][op_attribute_name].add_item(device_node)
  
      for threadid, nodes in nodelists.items():
          for node in nodes:
              for runtime_node in node.runtime_node:
                  for device_node in runtime_node.device_node:
                      if device_node.type == "Kernel":
                          name = device_node.name
                          if name not in self.kernel_items:
                              self.kernel_items[name] = DeviceItem(name)
                          self.kernel_items[name].add_item(device_node)
                          weighted_occupancy += (
                              device_node.occupancy / 100
                          ) * (
                              device_node.end_ns - device_node.start_ns
                          )
                          if device_node.blocks_per_sm > 1:
                              sm_efficiency = 1
                          else:
                              sm_efficiency = device_node.blocks_per_sm
                          weighted_sm_efficiency += sm_efficiency * (
                              device_node.end_ns - device_node.start_ns
                          )
                          total_duration += (
                              device_node.end_ns - device_node.start_ns
                          )
                          self.gpu_ids.add(device_node.device_id)
      self.occupancy = (
          weighted_occupancy / total_duration
          if total_duration != 0
          else 0.0
      )
      self.sm_efficiency = weighted_sm_efficiency  # to divide ProfileStep time in ProfileData
      total_time = 0
      total_tensorcore_time = 0
      for name, node in self.kernel_items.items():
          if node.tensorcore_used:
              total_tensorcore_time += node.gpu_time
          total_time += node.gpu_time
      self.tensor_core_ratio = (
          total_tensorcore_time / total_time if total_time != 0 else 0.0
      )
  
file_path: VisualDL/visualdl/component/profiler/parser/kernel_parser.py
imports: import collections
label_desc: Use image node_id 2 for calling the KernelParser obj's underlying member method code with example usage: obj.parse(nodelists) without return types