From 75651e3cc4a7683970075c40334896927e4beaff Mon Sep 17 00:00:00 2001 From: Sam Estep Date: Tue, 20 Apr 2021 10:27:02 -0700 Subject: [PATCH] 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 --- .github/workflows/lint.yml | 2 +- GLOSSARY.md | 5 ++++- torch/csrc/jit/OVERVIEW.md | 13 ++++++----- torch/csrc/jit/docs/serialization.md | 32 ++++++++++++++++------------ torch/fx/OVERVIEW.md | 13 +++++------ 5 files changed, 38 insertions(+), 27 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b061df13c7c7f..62941385aa106 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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 '' -- '**.md'); do markdown-toc --bullets='-' -i "$FILE" done - name: Assert that regenerating the ToCs didn't change them diff --git a/GLOSSARY.md b/GLOSSARY.md index 24300e7f722b8..bf9e6a8b6c7a1 100644 --- a/GLOSSARY.md +++ b/GLOSSARY.md @@ -1,6 +1,7 @@ # PyTorch Glossary -- [PyTorch Glossary](#pytorch-glossary) + + - [Operation and Kernel](#operation-and-kernel) - [ATen](#aten) - [Operation](#operation) @@ -19,6 +20,8 @@ - [Tracing](#tracing) - [Scripting](#scripting) + + # Operation and Kernel ## ATen diff --git a/torch/csrc/jit/OVERVIEW.md b/torch/csrc/jit/OVERVIEW.md index 49abf278611da..f6c6247264c0b 100644 --- a/torch/csrc/jit/OVERVIEW.md +++ b/torch/csrc/jit/OVERVIEW.md @@ -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) + + - [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) + # Core Program Representation diff --git a/torch/csrc/jit/docs/serialization.md b/torch/csrc/jit/docs/serialization.md index 2fc3c9abb4290..b5187794e1600 100644 --- a/torch/csrc/jit/docs/serialization.md +++ b/torch/csrc/jit/docs/serialization.md @@ -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) + + +- [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) + + ## Overview diff --git a/torch/fx/OVERVIEW.md b/torch/fx/OVERVIEW.md index f3c0c716d73ea..f2995eb7a77dd 100644 --- a/torch/fx/OVERVIEW.md +++ b/torch/fx/OVERVIEW.md @@ -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) + + - [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) + + # Introduction