pytorch-guide
Avoid common PyTorch mistakes and apply robust training patterns
npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill pytorch-guide --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# PyTorch Guide ## Overview PyTorch is the dominant deep learning framework in academic research, used in the majority of papers at NeurIPS, ICML, and ICLR. Its eager execution model, Pythonic API, and seamless integration with the Python scientific stack make it the default choice for prototyping and publishing research code. However, PyTorch's flexibility is a double-edged sword. Subtle bugs -- forgetting `model.eval()`, accumulating gradients across batches, incorrect device placement, memory leaks from detached tensors -- can silently corrupt results without raising errors. These issues are especially dangerous in research settings where ground truth is unknown. This guide catalogs the most common PyTorch mistakes, provides battle-tested training patterns, and covers performance optimization techniques that every researcher should know. The patterns here are drawn from top-tier ML research codebases and the PyTorch team's own best practice recommendations. ## Common Mistakes and Fixes ### The Big Five Mistakes ```python # MISTAKE 1: Forgetting model.eval() and torch.no_grad() # This causes dropout and batch norm to behave incorrectly during evaluation # and wastes memory by tra
- Overview
- Common Mistakes and Fixes
- The Big Five Mistakes
- Robust Training Template
- Performance Optimization
- GPU Memory Management
- Reproducibility Checklist
- Best Practices
- References
What does the pytorch-guide skill do?
Avoid common PyTorch mistakes and apply robust training patterns
How do I install it?
Run `npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill pytorch-guide --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From brycewang-stanford/Auto-Empirical-Research-Skills, a repository with 3,244 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.