Add remaining ToCs to ToC lint (#56487)

Summary:
The lint was originally added in https://github.com/pytorch/pytorch/issues/54974, but at the time I didn't realize that these other Markdown files also each have a table of contents:

- `GLOSSARY.md`
- `torch/csrc/jit/OVERVIEW.md`
- `torch/csrc/jit/docs/serialization.md`
- `torch/fx/OVERVIEW.md`

This PR adds those files to the lint, and also changes the rule from using a fixed list of filenames to a `git grep` command that finds all Markdown files containing this magic comment:

```md

```

Pull Request resolved: https://github.com/pytorch/pytorch/pull/56487

Test Plan: The "Lint / toc" job in GitHub Actions.

Reviewed By: janeyx99

Differential Revision: D27884885

Pulled By: samestep

fbshipit-source-id: 5462437502b17fba93abf5098e21754bf566a4fe
This commit is contained in:
Sam Estep
2021-04-20 10:27:02 -07:00
committed by Facebook GitHub Bot
parent 062e70590c
commit 75651e3cc4
5 changed files with 38 additions and 27 deletions

View File

@ -128,7 +128,7 @@ jobs:
run: |
set -eux
export PATH=~/.npm-global/bin:"$PATH"
for FILE in {CONTRIBUTING,README}.md; do
for FILE in $(git grep -Il '<!-- toc -->' -- '**.md'); do
markdown-toc --bullets='-' -i "$FILE"
done
- name: Assert that regenerating the ToCs didn't change them

View File

@ -1,6 +1,7 @@
# PyTorch Glossary
- [PyTorch Glossary](#pytorch-glossary)
<!-- toc -->
- [Operation and Kernel](#operation-and-kernel)
- [ATen](#aten)
- [Operation](#operation)
@ -19,6 +20,8 @@
- [Tracing](#tracing)
- [Scripting](#scripting)
<!-- tocstop -->
# Operation and Kernel
## ATen

View File

@ -14,8 +14,8 @@ Sections start with a reference to the source file where the code related to the
## Table of Contents
- [JIT Technical Overview](#jit-technical-overview)
- [Table of Contents](#table-of-contents)
<!-- toc -->
- [Core Program Representation](#core-program-representation)
- [Modules](#modules)
- [Parameters](#parameters)
@ -26,6 +26,7 @@ Sections start with a reference to the source file where the code related to the
- [Block](#block)
- [If](#if)
- [Loops](#loops)
- [With](#with)
- [Value](#value)
- [Type](#type)
- [Generating Programs](#generating-programs)
@ -37,11 +38,12 @@ Sections start with a reference to the source file where the code related to the
- [Lexer](#lexer)
- [Tokens](#tokens)
- [Parser](#parser)
- [Compiler](#compiler)
- [IR Emitter](#ir-emitter)
- [SugaredValue](#sugaredvalue)
- [Resolver](#resolver)
- [Environment](#environment)
- [SSA Conversion](#convert_to_ssa)
- [Conversion To SSA](#conversion-to-ssa)
- [Exit Transform](#exit-transform)
- [Python-Compiler Interaction](#python-compiler-interaction)
- [Executing Programs](#executing-programs)
- [Evaluation Semantics](#evaluation-semantics)
@ -59,7 +61,7 @@ Sections start with a reference to the source file where the code related to the
- [Aliasing and mutation in the PyTorch API](#aliasing-and-mutation-in-the-pytorch-api)
- [Aliasing and mutation annotations in FunctionSchema](#aliasing-and-mutation-annotations-in-functionschema)
- [Alias Analysis in the IR](#alias-analysis-in-the-ir)
- [Writing optimization passes with AliasDb](#writing-optimization-passes-with-aliasdb)
- [Writing optimization passes with `AliasDb`](#writing-optimization-passes-with-aliasdb)
- [Profiling Programs](#profiling-programs)
- [Saving Programs](#saving-programs)
- [Testing Programs](#testing-programs)
@ -67,6 +69,7 @@ Sections start with a reference to the source file where the code related to the
- [Python Printer](#python-printer)
- [Python Bindings](#python-bindings)
<!-- tocstop -->
# Core Program Representation

View File

@ -3,6 +3,8 @@
This document explains the TorchScript serialization format, and the anatomy
of a call to `torch::jit::save()` or `torch::jit::load()`.
<!-- toc -->
- [Overview](#overview)
- [Design Notes](#design-notes)
- [`code/`: How code is serialized](#code-how-code-is-serialized)
@ -10,14 +12,16 @@ of a call to `torch::jit::save()` or `torch::jit::load()`.
- [Placing the source code in the archive](#placing-the-source-code-in-the-archive)
- [How data is serialized](#how-data-is-serialized)
- [`data.pkl`: How module object state is serialized](#datapkl-how-module-object-state-is-serialized)
- [`data/`: How tensors are serialized](#tensors-how-tensors-are-serialized)
- [`data/`: How tensors are serialized](#data-how-tensors-are-serialized)
- [`constants.pkl`: Constants in code](#constantspkl-constants-in-code)
- [`torch:jit::load()`](#torchjitload)
- [`__getstate__` and `__setstate__`](#getstate-and-setstate)
- [`__getstate__` and `__setstate__`](#__getstate__-and-__setstate__)
- [Appendix: `CompilationUnit` and code object ownership](#appendix-compilationunit-and-code-object-ownership)
- [`CompilationUnit` ownership semantics](#compilationunit-ownership-semantics)
- [Code object naming](#code-object-naming)
<!-- tocstop -->
## Overview
A serialized model (call it `model.pt`) is a ZIP archive containing many

View File

@ -4,21 +4,22 @@ FX is a toolkit for pass writers to facilitate Python-to-Python transformation o
## Table of Contents
- [FX Technical Overview](#fx-technical-overview)
- [Table of Contents](#table-of-contents)
<!-- toc -->
- [Introduction](#introduction)
- [Motivation](#motivation)
- [Use Cases](#use-cases)
- [Technical Details](#technical-details)
- [Internal Structure](#internal-structure)
- [Graph](#graph)
- [Graph Module](#graph-module)
- [GraphModule](#graphmodule)
- [Symbolic Tracing](#symbolic-tracing)
- [About](#about)
- [Tracer](#tracer)
- [Proxy](#proxy)
- [The FX IR](#ir)
- [Transformation and Codegen](#codegen)
- [The FX IR](#the-fx-ir)
- [Transformation and Codegen](#transformation-and-codegen)
<!-- tocstop -->
# Introduction