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