code: def format_docs(module, kls):
      """Format the documentation for a module."""
      assert getattr(kls, "__doc__") is not None
      markdown = ["## {0}".format(kls.__name__)]
      sections = parse_docs(kls.__doc__)
      for header, section in sections:
          if header is None:
              # Add special case for inherited documentation
              if len(sections) > 1:
                  markdown.append(section[0].strip())
              signature = "{0}.{1}{2}".format(
                  module.__name__,
                  kls.__name__,
                  str(inspect.signature(kls)),
              )
              markdown.append(format_signature(signature))
              if len(sections) == 1 and any(
                  c is nn.Module for c in inspect.getmro(kls)
              ):
                  markdown.append(
                      format_notes(
                          [
                              "See: `torch.nn.{0}`".format(
                                  kls.__name__[4:]
                              )
                          ]
                      )
                  )
          elif header == "Parameters":
              markdown.append(format_parameters(section))
          elif header == "Notes":
              markdown.append(format_notes(section))
          elif header == "References":
              markdown.append(format_references(section))
      return "\n\n".join(markdown)
  
file_path: pytorch-meta/docs/scripts/api_reference.py
imports: import importlib
  import inspect
  import re
  import yaml
  import logging
  import torch.nn
label_desc: Use image node_id 5 for calling a global function with example usage: format_docs(module, kls) and returns: str