xref: /aosp_15_r20/external/pytorch/tools/README.md (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1This folder contains a number of scripts which are used as
2part of the PyTorch build process.  This directory also doubles
3as a Python module hierarchy (thus the `__init__.py`).
4
5## Overview
6
7Modern infrastructure:
8
9* [autograd](autograd) - Code generation for autograd.  This
10  includes definitions of all our derivatives.
11* [jit](jit) - Code generation for JIT
12* [shared](shared) - Generic infrastructure that scripts in
13  tools may find useful.
14  * [module_loader.py](shared/module_loader.py) - Makes it easier
15    to import arbitrary Python files in a script, without having to add
16    them to the PYTHONPATH first.
17
18Build system pieces:
19
20* [setup_helpers](setup_helpers) - Helper code for searching for
21  third-party dependencies on the user system.
22* [build_pytorch_libs.py](build_pytorch_libs.py) - cross-platform script that
23  builds all of the constituent libraries of PyTorch,
24  but not the PyTorch Python extension itself.
25* [build_libtorch.py](build_libtorch.py) - Script for building
26  libtorch, a standalone C++ library without Python support.  This
27  build script is tested in CI.
28
29Developer tools which you might find useful:
30
31* [git_add_generated_dirs.sh](git_add_generated_dirs.sh) and
32  [git_reset_generated_dirs.sh](git_reset_generated_dirs.sh) -
33  Use this to force add generated files to your Git index, so that you
34  can conveniently run diffs on them when working on code-generation.
35  (See also [generated_dirs.txt](generated_dirs.txt) which
36  specifies the list of directories with generated files.)
37
38Important if you want to run on AMD GPU:
39
40* [amd_build](amd_build) - HIPify scripts, for transpiling CUDA
41  into AMD HIP.  Right now, PyTorch and Caffe2 share logic for how to
42  do this transpilation, but have separate entry-points for transpiling
43  either PyTorch or Caffe2 code.
44  * [build_amd.py](amd_build/build_amd.py) - Top-level entry
45    point for HIPifying our codebase.
46
47Tools which are only situationally useful:
48
49* [docker](docker) - Dockerfile for running (but not developing)
50  PyTorch, using the official conda binary distribution.  Context:
51  https://github.com/pytorch/pytorch/issues/1619
52* [download_mnist.py](download_mnist.py) - Download the MNIST
53  dataset; this is necessary if you want to run the C++ API tests.
54
55[actions/github-script]: https://github.com/actions/github-script
56[flake8]: https://flake8.pycqa.org/en/latest/
57[github actions expressions]: https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#about-contexts-and-expressions
58[pytorch/add-annotations-github-action]: https://github.com/pytorch/add-annotations-github-action
59[shellcheck]: https://github.com/koalaman/shellcheck
60