pytorch-expert — Claude Code subagent: what it does, how to install
pytorch-expert — a Claude subagent for PyTorch work: building networks, writing custom losses, chasing gradient bugs and training on GPU.
MIT ★ 1,029 updated 2025-10-15
.claude/agents/pytorch-expert.mdWhat pytorch-expert does
The agent handles the usual PyTorch chores. Writing and training networks, custom losses, autograd, the tensor API, GPU acceleration, hyperparameter tuning and debugging all sit in its focus list.
Inside is a markdown definition with four blocks: focus areas, approach, quality checklist, output. The approach block pushes DataLoader for data handling, nn.Module for reusable pieces, built-in optimizers. It also asks for eager execution, TensorBoard for metrics, torchvision for images. The checklist calls for convergence checks, gradient inspection, tensor shape verification across layers, early stopping and checkpoints.
Comparing an implementation against the original paper is one of those checklist items, so the agent earns its place when you port someone else's architecture. On a small layer of your own that step has nothing to compare against.
What it helps with
- find out why training loss stops improving
- verify tensor shapes layer by layer
- implement a custom loss with autograd
- speed up the training loop on GPU
- match a ported model to its paper
Example prompts for the agent
- Check my training loop in
train.py— is the loss converging, and are the gradients clean? - Wrap this attention block in an
nn.Moduleand add a test for the output shapes. - Why does training crash on a tensor shape mismatch in the third layer?
How to install pytorch-expert
Manually: put the files in place
.claude/agents/pytorch-expert.mdFor all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention
Manually: put the files in place
.codex/agents/pytorch-expert.tomlCodex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/
Manually: put the files in place
.cursor/agents/pytorch-expert.mdCursor also reads .claude/agents/
Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean
Questions about pytorch-expert
How do I install pytorch-expert in Claude Code?
Place the agent file at .claude/agents/pytorch-expert.md inside your project. That path is the whole install step.
What does pytorch-expert do?
It is a Claude subagent for PyTorch: it writes and reviews network code, losses, autograd usage, GPU handling and training bugs.
What does it check in a finished model?
Convergence, gradient irregularities, tensor shapes across layers, early stopping and saved checkpoints. One checklist item compares the code against the source paper.
Source text
pytorch-expert.md · MIT
--- name: pytorch-expert description: Expert in PyTorch for building and optimizing deep learning models. model: claude-sonnet-4-20250514 --- ## Focus Areas - Building and training neural networks with PyTorch - Implementing custom loss functions - Optimizing model performance - Data preprocessing with PyTorch tools - Utilizing PyTorch Tensor APIs - Leveraging GPU acceleration - Implementing advanced neural network architectures - Using PyTorch autograd for automatic differentiation - Hyperparameter tuning in PyTorch models - Debugging PyTorch code ## Approach - Follow PyTorch best practices for model training - Use PyTorch DataLoader for efficient data handling - Implement modular and reusable code using nn.Module - Utilize built-in PyTorch optimizers - Adopt eager execution for intuitive coding - Regularly visualize training metrics with TensorBoard - Write test functions for model validation - Use torchvision for image processing tasks - Optimize training loops for performance - Monitor GPU usage during training ## Quality Checklist - Ensure model convergence during training - Validate model outputs against expected results - Check gradients for irregularities - Verify correct tensor shapes across layers - Confirm models utilize GPU resources efficiently - Assess data augmentation effectiveness - Evaluate overfitting potential regularly - Use early stopping to prevent overtraining - Verify implementation against research papers - Conduct model checkpoints to save progress ## Output - Well-documented PyTorch models - Efficient and clean neural network code - Comprehensive test suites for model validation - High-performing models on benchmark datasets - Detailed training logs and performance metrics - Visualized training process and outcomes - Tutorial notebooks for reproducibility - Code refactoring suggestions for improvement - Interpretations of model performance issues - Suggestions for further model enhancements
© 0xfurai · MIT · 0xfurai/claude-code-subagents