Skip to main content
rule CX Codex

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

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/pytorch.mdc
Open on GitHub

What 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.Module components
  • load batches through Dataset and DataLoader
  • 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.Module components.
  • Set up data loading with Dataset and DataLoader.

How to install pytorch

Manually: put the files in place

.cursor/rules/pytorch.mdc

Frontmatter: description, globs, alwaysApply

Step 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.

pytorch sanjeed5 Enforces clean PyTorch patterns across Python files in Cursor. Instructs the assistant to separate modules, place tensors on devices explicitly, and disable gradients in inference. CX Codex +1 ★ 3,589repo stars pytorch-lightning K-Dense-AI Guides agents through structuring PyTorch Lightning 2.6.6 code, from LightningModules to distributed trainers. Useful when scaling training across GPUs. CX Codex +1 2,300installs pytorch-scikit-learn-cursorrules-prompt-file PatrickJS The pytorch-scikit-learn-cursorrules-prompt-file Cursor rule guides Python machine-learning work on chemistry problems with scikit-learn and PyTorch. It covers molecular data, model training, and evaluation. CX Codex +1 ★ 41,178repo stars pytorch-expert 0xfurai pytorch-expert — a Claude subagent for PyTorch work: building networks, writing custom losses, chasing gradient bugs and training on GPU. CX Codex ★ 1,029repo stars torchcode-pytorch-interview-practice reason-machines The torchcode-pytorch-interview-practice skill for Claude Code provides 40 PyTorch practice problems with auto-grading, gradient checks and timing for ML interview preparation. CX Codex +1 806installs paper2code-arxiv-implementation reason-machines paper2code-arxiv-implementation converts arXiv papers into working Python code anchored to equations and sections. It audits ambiguities and flags missing paper details before execution. CX Codex +1 643installs pytorch-patterns affaan-m The pytorch-patterns skill guides PyTorch model, training-loop, and data-loading work with practical patterns. Use it when reviewing code or tracking down runs that fail to reproduce. CX Codex +1 6,600installs

From the same set11

The whole set →
debug The debug rule sets the order for troubleshooting: gather evidence and context, explain the cause, then edit code. It applies when an error persists or a fix is incomplete. CX Codex +1 ★ 1,054repo stars cursor-rules-location cursor-rules-location keeps repository rule files organized by rejecting any .mdc files created outside the .cursor/rules directory. CX Codex +1 ★ 1,054repo stars develop-mcp-server The develop-mcp-server rule structures MCP server work from planning to validation, with setup guidance for Node.js and Python projects. CX Codex +1 ★ 1,054repo stars plan Makes the agent read your docs, task notes and source before planning, ask clarifying questions, and only then propose a solution. CX Codex +1 ★ 1,054repo stars implement implement enforces a strict coding protocol with dependency checks, step-by-step edits, simulation passes, and automated test coverage before finalizing changes. CX Codex +1 ★ 1,054repo stars memory This rule organizes project memory across docs/, tasks/, and .cursor/rules/. It helps an agent retain plans, context, errors, and project decisions between tasks. CX Codex +1 ★ 1,054repo stars memory Keeps project memory in a fixed set of files the agent reads before work: requirements, architecture, stack, task plan, current state. CX Codex +1 ★ 1,054repo stars langgraph Architecture guidelines and coding conventions for Python projects built on LangGraph, focusing on state schemas and graph structure. CX Codex +1 ★ 1,054repo stars

Project sponsors

Companies that keep this analytics open