code: def generate_tag_rst(tag_to_modules):
      """
      For each tag that shows up in each ExportCase.tag, generate an .rst file
      containing all the examples that have that tag.
      """
  
      for tag, modules_rst in tag_to_modules.items():
          doc_contents = f"{tag}\n{'=' * (len(tag) + 4)}\n"
          full_modules_rst = "\n\n".join(modules_rst)
          full_modules_rst = re.sub(
              r"={3,}",
              lambda match: "-" * len(match.group()),
              full_modules_rst,
          )
          doc_contents += full_modules_rst
  
          with open(
              os.path.join(EXPORTDB_SOURCE, f"{tag}.rst"), "w"
          ) as f:
              f.write(doc_contents)
  
file_path: pytorch/docs/source/scripts/exportdb/generate_example_rst.py
imports: import inspect
  import os
  import re
  from pathlib import Path
  import torch
  import torch._dynamo
  from torch._export.db.case import ExportCase, normalize_inputs
  from torch._export.db.examples import all_examples
  from torch.export import export
label_desc: Use image node_id 3 for calling a global function with example usage: generate_tag_rst(tag_to_modules) without return types