code: def to_markdown_table(
      res: TimingResultType, header: Tuple[str, ...] = None
  ) -> str:
      if header is None:
          header = ("model", "task", "mean", "var")
      out = ""
  
      def write_line(*args):
          nonlocal out
          out += f"| {' | '.join(str(a) for a in args)} |\n"
  
      # Make it a markdown table
      write_line(*header)
      write_line(*["--"] * len(header))
      for model, tasks in res.items():
          for task, line in tasks.items():
              write_line(*(model, task) + line)
  
      return out
  
file_path: pytorch/benchmarks/functional_autograd_benchmark/utils.py
imports: from collections import defaultdict
  from typing import Callable, Dict, List, Tuple, Union
  import torch
  from torch import nn, Tensor
label_desc: Use image node_id 5 for calling a global function with example usage: to_markdown_table(res, header) and returns: out