pytorch · bhartendu-kumar — Claude Code rule for PyTorch projects
pytorch is a Claude Code rule for structuring and writing PyTorch code. It applies to Python files matched by **/*.py.
no license ★ 1,054 updated 2025-07-17
.cursor/rules/pytorch.mdcWhat pytorch does
pytorch gives the agent guidelines for organizing PyTorch projects. It covers directories and modules, model components built with nn.Module, data loading, and reusable code.
The guidance also addresses testing, security, performance, and common coding mistakes. It describes splitting complex networks into smaller parts and mentions DataParallel and DistributedDataParallel for multi-GPU training. The rule targets files matching **/*.py.
What it helps with
- organize a PyTorch project into modules and directories
- split a network into reusable
nn.Modulecomponents - load batches through
DatasetandDataLoader - choose a multi-GPU training approach
Example prompts for the agent
- Organize this PyTorch project into clear modules and directories.
- Break this network into reusable
nn.Modulecomponents. - Set up data loading with
DatasetandDataLoader.
How to install pytorch
Manually: put the files in place
.cursor/rules/pytorch.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/pytorch.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/pytorch.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/pytorch.mdManually: put the files in place
.clinerules/pytorch.mdStep by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules
Questions about pytorch
How do I install pytorch in Claude Code?
Add the rule file at .claude/rules/pytorch.md.
What does pytorch do?
It gives coding guidance for PyTorch project structure, model components, data loading, and reusable modules.
Which files does pytorch apply to?
It applies to Python files matched by **/*.py.
Similar IDE rules
All IDE rules for AI and ML →pytorch by other authors comes first.