Skip to content

Commit

Permalink
Add remaining ToCs to ToC lint (pytorch#56487)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
samestep authored and facebook-github-bot committed Apr 20, 2021
1 parent 062e705 commit 75651e3
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion GLOSSARY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# PyTorch Glossary

- [PyTorch Glossary](#pytorch-glossary)
<!-- toc -->

- [Operation and Kernel](#operation-and-kernel)
- [ATen](#aten)
- [Operation](#operation)
Expand All @@ -19,6 +20,8 @@
- [Tracing](#tracing)
- [Scripting](#scripting)

<!-- tocstop -->

# Operation and Kernel

## ATen
Expand Down
13 changes: 8 additions & 5 deletions torch/csrc/jit/OVERVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -59,14 +61,15 @@ 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)
- [Test Autodiff](#test-autodiff)
- [Python Printer](#python-printer)
- [Python Bindings](#python-bindings)

<!-- tocstop -->

# Core Program Representation

Expand Down
32 changes: 18 additions & 14 deletions torch/csrc/jit/docs/serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,24 @@
This document explains the TorchScript serialization format, and the anatomy
of a call to `torch::jit::save()` or `torch::jit::load()`.

- [Overview](#overview)
- [Design Notes](#design-notes)
- [`code/`: How code is serialized](#code-how-code-is-serialized)
- [Printing code objects as Python source](#printing-code-objects-as-python-source)
- [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)
- [`constants.pkl`: Constants in code](#constantspkl-constants-in-code)
- [`torch:jit::load()`](#torchjitload)
- [`__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)
<!-- toc -->

- [Overview](#overview)
- [Design Notes](#design-notes)
- [`code/`: How code is serialized](#code-how-code-is-serialized)
- [Printing code objects as Python source](#printing-code-objects-as-python-source)
- [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](#data-how-tensors-are-serialized)
- [`constants.pkl`: Constants in code](#constantspkl-constants-in-code)
- [`torch:jit::load()`](#torchjitload)
- [`__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

Expand Down
13 changes: 7 additions & 6 deletions torch/fx/OVERVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 75651e3

Please sign in to comment.