code: def format_results(self):
      table = PrettyTable()
      name_counter = Counter([s["name"] for s in self.results])
      has_multi_use = any(map(lambda v: v > 1, name_counter.values()))
      name_counter = Counter()  # clear the counter to count from 0
  
      headers = [
          "Index",
          "Name",
          "Type",
          "Weight Shape",
          "Input Size",
          "Output Size",
          "FLOPs",
          "#Params",
      ]
      if has_multi_use:
          headers.append("#Call")
  
      table.field_names = headers
      for i, result in enumerate(self.results):
          flops_count = (
              int(result["flops"].item())
              if isinstance(result["flops"], torch.Tensor)
              else int(result["flops"])
          )
          row_values = [
              i,
              result["name"],
              result["module_type"],
              str(result["weight_shape"]),
              result["input_size"],
              result["output_size"],
              flops_count,
              result["params"],
          ]
          name_counter[result["name"]] += 1
          if has_multi_use:
              row_values.append(name_counter[result["name"]])
          table.add_row(row_values)
      table.align["Name"] = "l"
      return table
  
imports: import functools
  from collections import Counter
  from prettytable import PrettyTable
  import torch
  import torch.nn
  from torch.nn.utils.rnn import PackedSequence
  from nni.compression.base.wrapper import ModuleWrapper
label_desc: Use image node_id 23 for calling the ModelProfiler obj's underlying member method code with example usage: obj.format_results() and returns: table