Skip to content

Commit 75651e3

Browse files
samestepfacebook-github-bot
authored andcommitted
Add remaining ToCs to ToC lint (pytorch#56487)
Summary: The lint was originally added in pytorch#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: pytorch#56487 Test Plan: The "Lint / toc" job in GitHub Actions. Reviewed By: janeyx99 Differential Revision: D27884885 Pulled By: samestep fbshipit-source-id: 5462437502b17fba93abf5098e21754bf566a4fe
1 parent 062e705 commit 75651e3

File tree

5 files changed

+38
-27
lines changed

5 files changed

+38
-27
lines changed

.github/workflows/lint.yml

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

GLOSSARY.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# PyTorch Glossary
22

3-
- [PyTorch Glossary](#pytorch-glossary)
3+
<!-- toc -->
4+
45
- [Operation and Kernel](#operation-and-kernel)
56
- [ATen](#aten)
67
- [Operation](#operation)
@@ -19,6 +20,8 @@
1920
- [Tracing](#tracing)
2021
- [Scripting](#scripting)
2122

23+
<!-- tocstop -->
24+
2225
# Operation and Kernel
2326

2427
## ATen

torch/csrc/jit/OVERVIEW.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ Sections start with a reference to the source file where the code related to the
1414

1515
## Table of Contents
1616

17-
- [JIT Technical Overview](#jit-technical-overview)
18-
- [Table of Contents](#table-of-contents)
17+
<!-- toc -->
18+
1919
- [Core Program Representation](#core-program-representation)
2020
- [Modules](#modules)
2121
- [Parameters](#parameters)
@@ -26,6 +26,7 @@ Sections start with a reference to the source file where the code related to the
2626
- [Block](#block)
2727
- [If](#if)
2828
- [Loops](#loops)
29+
- [With](#with)
2930
- [Value](#value)
3031
- [Type](#type)
3132
- [Generating Programs](#generating-programs)
@@ -37,11 +38,12 @@ Sections start with a reference to the source file where the code related to the
3738
- [Lexer](#lexer)
3839
- [Tokens](#tokens)
3940
- [Parser](#parser)
40-
- [Compiler](#compiler)
41+
- [IR Emitter](#ir-emitter)
4142
- [SugaredValue](#sugaredvalue)
4243
- [Resolver](#resolver)
4344
- [Environment](#environment)
44-
- [SSA Conversion](#convert_to_ssa)
45+
- [Conversion To SSA](#conversion-to-ssa)
46+
- [Exit Transform](#exit-transform)
4547
- [Python-Compiler Interaction](#python-compiler-interaction)
4648
- [Executing Programs](#executing-programs)
4749
- [Evaluation Semantics](#evaluation-semantics)
@@ -59,14 +61,15 @@ Sections start with a reference to the source file where the code related to the
5961
- [Aliasing and mutation in the PyTorch API](#aliasing-and-mutation-in-the-pytorch-api)
6062
- [Aliasing and mutation annotations in FunctionSchema](#aliasing-and-mutation-annotations-in-functionschema)
6163
- [Alias Analysis in the IR](#alias-analysis-in-the-ir)
62-
- [Writing optimization passes with AliasDb](#writing-optimization-passes-with-aliasdb)
64+
- [Writing optimization passes with `AliasDb`](#writing-optimization-passes-with-aliasdb)
6365
- [Profiling Programs](#profiling-programs)
6466
- [Saving Programs](#saving-programs)
6567
- [Testing Programs](#testing-programs)
6668
- [Test Autodiff](#test-autodiff)
6769
- [Python Printer](#python-printer)
6870
- [Python Bindings](#python-bindings)
6971

72+
<!-- tocstop -->
7073

7174
# Core Program Representation
7275

torch/csrc/jit/docs/serialization.md

+18-14
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,24 @@
33
This document explains the TorchScript serialization format, and the anatomy
44
of a call to `torch::jit::save()` or `torch::jit::load()`.
55

6-
- [Overview](#overview)
7-
- [Design Notes](#design-notes)
8-
- [`code/`: How code is serialized](#code-how-code-is-serialized)
9-
- [Printing code objects as Python source](#printing-code-objects-as-python-source)
10-
- [Placing the source code in the archive](#placing-the-source-code-in-the-archive)
11-
- [How data is serialized](#how-data-is-serialized)
12-
- [`data.pkl`: How module object state is serialized](#datapkl-how-module-object-state-is-serialized)
13-
- [`data/`: How tensors are serialized](#tensors-how-tensors-are-serialized)
14-
- [`constants.pkl`: Constants in code](#constantspkl-constants-in-code)
15-
- [`torch:jit::load()`](#torchjitload)
16-
- [`__getstate__` and `__setstate__`](#getstate-and-setstate)
17-
- [Appendix: `CompilationUnit` and code object ownership](#appendix-compilationunit-and-code-object-ownership)
18-
- [`CompilationUnit` ownership semantics](#compilationunit-ownership-semantics)
19-
- [Code object naming](#code-object-naming)
6+
<!-- toc -->
7+
8+
- [Overview](#overview)
9+
- [Design Notes](#design-notes)
10+
- [`code/`: How code is serialized](#code-how-code-is-serialized)
11+
- [Printing code objects as Python source](#printing-code-objects-as-python-source)
12+
- [Placing the source code in the archive](#placing-the-source-code-in-the-archive)
13+
- [How data is serialized](#how-data-is-serialized)
14+
- [`data.pkl`: How module object state is serialized](#datapkl-how-module-object-state-is-serialized)
15+
- [`data/`: How tensors are serialized](#data-how-tensors-are-serialized)
16+
- [`constants.pkl`: Constants in code](#constantspkl-constants-in-code)
17+
- [`torch:jit::load()`](#torchjitload)
18+
- [`__getstate__` and `__setstate__`](#__getstate__-and-__setstate__)
19+
- [Appendix: `CompilationUnit` and code object ownership](#appendix-compilationunit-and-code-object-ownership)
20+
- [`CompilationUnit` ownership semantics](#compilationunit-ownership-semantics)
21+
- [Code object naming](#code-object-naming)
22+
23+
<!-- tocstop -->
2024

2125
## Overview
2226

torch/fx/OVERVIEW.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,22 @@ FX is a toolkit for pass writers to facilitate Python-to-Python transformation o
44

55
## Table of Contents
66

7-
- [FX Technical Overview](#fx-technical-overview)
8-
- [Table of Contents](#table-of-contents)
7+
<!-- toc -->
8+
99
- [Introduction](#introduction)
1010
- [Motivation](#motivation)
1111
- [Use Cases](#use-cases)
1212
- [Technical Details](#technical-details)
1313
- [Internal Structure](#internal-structure)
1414
- [Graph](#graph)
15-
- [Graph Module](#graph-module)
15+
- [GraphModule](#graphmodule)
1616
- [Symbolic Tracing](#symbolic-tracing)
17-
- [About](#about)
1817
- [Tracer](#tracer)
1918
- [Proxy](#proxy)
20-
- [The FX IR](#ir)
21-
- [Transformation and Codegen](#codegen)
19+
- [The FX IR](#the-fx-ir)
20+
- [Transformation and Codegen](#transformation-and-codegen)
21+
22+
<!-- tocstop -->
2223

2324
# Introduction
2425

0 commit comments

Comments
 (0)