Real files, at real paths, counted every nightCounted 08:17 UTCDiff two files
7,205instruction files1,198repositories visited4,189rows written36files changed8formats20section tags85stacksCounted 13 September 2026
.github/copilot-instructions.mdpytorch/pytorch on mainOpen on GitHubpytorchRaw file4.7 kBDiff against another filePick the second file

copilot-instructions.md in pytorch/pytorch runs 601 words across 17 headings.

Tensors and Dynamic neural networks in Python with strong GPU acceleration

PythonPython103k starsChanged 23 days ago4.7 kBNested, not at the rootCopilot instructions
Covers

9 of the 20 section tags

In the order a file is read in
Headings

17 headings, in the order the file writes them

01PyTorch Copilot Instructions
02Architecture Overview
03Core Components
04The Code Generation Workflow
05Development Workflows
06Building from Source
07Testing
08Linting
09Project-Specific Conventions
10Memory and Storage
11Python-C++ Integration (`torch/csrc/`)
12Dispatch System
13Git Workflow (AI Agent Specific)
14Resolve conflicts if necessary
15Common Gotchas
16Key Files Reference
17Performance Debugging
Commands

8 commands this file writes down

Extracted from the file, verbatim
python -m pip install --no-build-isolation -v -e .
python test/test_torch.py TestTorch.test_specific_case
git stash -u
git reset --hard $(cat /tmp/orig_work.txt)
git stash pop
ninja
pip install ninja
cmake/EnvVarForwarding.cmake
The file

.github/copilot-instructions.md

128 lines
1# PyTorch Copilot Instructions
2
3This is the PyTorch machine learning framework codebase. These instructions help AI agents navigate and contribute effectively.
4
5## Architecture Overview
6
7### Core Components
8
9- **c10/** - Core library (C++-10 compatible) for essential, binary-size-conscious functionality
10- **aten/** - ATen tensor library (C++), PyTorch's foundation without autograd
11 - `aten/src/ATen/native/` - Modern operator implementations (CPU/CUDA/MPS/sparse)
12 - `aten/src/ATen/native/native_functions.yaml` - **Critical**: Declarative operator registry
13- **torch/** - Python bindings and public API
14 - `torch/csrc/` - C++ Python bindings (hand-written and generated)
15 - `torch/csrc/autograd/` - Reverse-mode automatic differentiation
16 - `torch/csrc/jit/` - TorchScript JIT compiler
17- **torchgen/** - Code generation tooling that reads `native_functions.yaml`
18- **tools/** - Build scripts, autograd derivatives, code generation
19
20### The Code Generation Workflow
21
22**Most operator changes require editing `native_functions.yaml`**, not direct C++ files. This YAML file:
231. Declares operator signatures, variants (function/method), and dispatch behavior
242. Gets processed by `torchgen/` to generate C++/Python bindings
253. Produces headers in `build/aten/src/ATen/` during compilation
26
27Example entry structure:
28```yaml
29- func: my_op(Tensor self, Scalar alpha=1) -> Tensor
30 variants: function, method
31 dispatch:
32 CPU: my_op_cpu
33 CUDA: my_op_cuda
34```
35
36After editing `native_functions.yaml`, implement kernels in `aten/src/ATen/native/` (see `aten/src/ATen/native/README.md`).
37
38## Development Workflows
39
40### Building from Source
41
42**Never run `setup.py` directly** - use pip with editable install:
43```bash
44python -m pip install --no-build-isolation -v -e .
45```
46
47Speed up builds:
48- `DEBUG=1` - Debug symbols with `-g -O0`
49- `USE_CUDA=0` - Skip CUDA compilation
50- `BUILD_TEST=0` - Skip C++ test binaries
51- Install `ninja` (`pip install ninja`) for faster builds
52- Use `ccache` for incremental compilation caching
53
54Full list of build environment variables: [`cmake/EnvVarForwarding.cmake`](../cmake/EnvVarForwarding.cmake)
55
56Rebuild specific targets: `(cd build && ninja <target>)`
57
58### Testing
59
60**Critical**: DO NOT run entire test suites. Run specific tests only:
61```bash
62python test/test_torch.py TestTorch.test_specific_case
63```
64
65**Test structure**: All tests use `torch.testing._internal.common_utils`:
66```python
67from torch.testing._internal.common_utils import run_tests, TestCase
68
69class TestFeature(TestCase):
70 def test_something(self):
71 # Use self.assertEqual for tensor comparisons
72 pass
73
74if __name__ == "__main__":
75 run_tests()
76```
77
78**For bug fixes**: Create a standalone reproduction script first, verify it fails, then fix and add to appropriate test file.
79
80### Linting
81
82Run linter (not pre-commit): `lintrunner -a` (auto-applies fixes)
83
84## Project-Specific Conventions
85
86### Memory and Storage
87- **Storage is never nullptr** (but `StorageImpl.data` may be nullptr for unallocated outputs)
88- CUDA device info lives in storage objects
89
90### Python-C++ Integration (`torch/csrc/`)
91- Always include `Python.h` **first** to avoid `_XOPEN_SOURCE` redefinition errors
92- Use `pybind11::gil_scoped_acquire` before calling Python API or using `THPObjectPtr`
93- Wrap entry points with `HANDLE_TH_ERRORS` / `END_HANDLE_TH_ERRORS` for exception conversion
94
95### Dispatch System
96- PyTorch uses operator dispatch to route calls to backend-specific kernels
97- Prefer `CompositeExplicitAutograd` dispatch when writing device-agnostic compound ops
98- See `aten/src/ATen/native/README.md` for dispatch keyword guidance
99
100## Git Workflow (AI Agent Specific)
101
102When preparing PRs from this environment:
103```bash
104git stash -u
105git reset --hard $(cat /tmp/orig_work.txt) # Reset to LOCAL branch
106git stash pop
107# Resolve conflicts if necessary
108```
109
110## Common Gotchas
111
1121. **Editing generated files** - If it's in `build/`, don't edit it. Edit the source template or `native_functions.yaml`
1132. **NVCC template compilation** - NVCC is stricter about C++ than gcc/clang; code working on Linux may fail Windows CI
1143. **Windows symbol visibility** - Use `TORCH_API` macros for exported symbols (required on Windows, optional on Linux)
1154. **No internet access** - DO NOT attempt to install dependencies during development
116
117## Key Files Reference
118
119- `AGENTS.md` - Instructions specific to AI coding agents
120- `CONTRIBUTING.md` - Comprehensive human contributor guide
121- `GLOSSARY.md` - Terminology (ATen, kernels, operations, JIT, TorchScript)
122- `aten/src/ATen/native/README.md` - Operator implementation guide
123- `tools/autograd/derivatives.yaml` - Gradient definitions for autograd
124
125## Performance Debugging
126
127Use `TORCH_SHOW_CPP_STACKTRACES=1` for C++ traces in Python errors. For profiling, prefer `py-spy` over manual instrumentation.
128
The rest of the repository

pytorch/pytorch ships 2 other instruction files

torch/_dynamo/CLAUDE.mdCLAUDE.md

A row that is not a link is a file this repository ships that this app did not freeze a sheet for. It is listed because the corpus knows it exists, and it is not linked because there is nothing here to open.

This listing

Whoever runs pytorch/pytorch can claim it

This is yours? Claim this config and we will write to you when the measurement moves. The check is one token placed where only you can place it, and there is no account and no password.