class_docstr: Hold all parsed data to serve for user requests.
class_docstr_tok: ["Hold","all","parsed","data","to","serve","for","user","requests","."]
code: def get_model_perspective_perstep(self, device_type, time_unit):
      if not self.overview_parser:
          return
      try:
          data = OrderedDict()
          data["order"] = []
          steps = [
              int(step_id)
              for step_id in self.model_perspective_items[
                  "ProfileStep"
              ].cpu_times.keys()
          ]
          steps = sorted(steps)
          data["steps"] = steps
          for stage_name in [
              "Dataloader",
              "Forward",
              "Backward",
              "Optimization",
              "Other",
          ]:
              if stage_name not in self.model_perspective_items:
                  continue
              data["order"].append(stage_name)
              data[stage_name] = []
              for stage_idx in steps:
                  stage_idx = str(stage_idx)
                  if device_type == "cpu":
                      if (
                          stage_idx
                          in self.model_perspective_items[
                              stage_name
                          ].cpu_times
                      ):
                          data[stage_name].append(
                              format_time(
                                  self.model_perspective_items[
                                      stage_name
                                  ].cpu_times[stage_idx],
                                  time_unit,
                              )
                          )
                      else:
                          data[stage_name].append(0)
                  else:
                      if (
                          stage_idx
                          in self.model_perspective_items[
                              stage_name
                          ].gpu_times
                      ):
                          data[stage_name].append(
                              format_time(
                                  self.model_perspective_items[
                                      stage_name
                                  ].gpu_times[stage_idx],
                                  time_unit,
                              )
                          )
                      else:
                          data[stage_name].append(0)
      except Exception as e:
          print("error in get_model_perspective_perstep", e)
      new_data = {}
      new_data["order"] = data["order"]
      new_data["steps"] = data["steps"]
      new_data["data"] = []
      for name in new_data["order"]:
          new_data["data"].append(data[name])
      return new_data
  
imports: from collections import defaultdict
  from collections import OrderedDict
  from .parser.distributed_parser import DistributedParser
  from .parser.kernel_parser import KernelParser
  from .parser.memory_parser import MemoryParser
  from .parser.operator_parser import OperatorParser
  from .parser.overview_parser import CPUType
  from .parser.overview_parser import GPUType
  from .parser.overview_parser import OverviewParser
  from .parser.trace_parser import TraceParser
  from .parser.utils import format_float
  from .parser.utils import format_memory
  from .parser.utils import format_ratio
  from .parser.utils import format_time
  from .parser.utils import traverse_tree
label_desc: Use image node_id 5 for calling the ProfilerData obj's underlying member method code with example usage: obj.get_model_perspective_perstep(device_type, time_unit) and returns: new_data