pytorch-model-cli
Guidance for implementing CLI tools that perform inference using PyTorch models in native languages (C/C++/Rust). This skill should be used when tasks involve extracting weights from PyTorch .pth files, implementing neural network forward passes in C/C++, or creating standalone inference tools without Python dependencies.
npx skills add majiayu000/claude-skill-registry --skill pytorch-model-cli --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 Model CLI Implementation ## Overview This skill provides procedural guidance for creating command-line tools that perform inference using PyTorch models without Python dependencies. These tasks typically involve extracting weights from `.pth` files, implementing forward passes in C/C++, and handling image preprocessing correctly. ## Workflow ### Phase 1: Analysis and Planning 1. **Examine the PyTorch model architecture** - Load the `.pth` file in Python to understand the model structure - Print layer names, weight shapes, and activation functions - Document the expected input dimensions and preprocessing requirements 2. **Inspect input data format** - Check image dimensions, color format (grayscale/RGB/RGBA), and bit depth - Determine expected normalization (0-1, -1 to 1, ImageNet stats, etc.) - Verify input matches model expectations (e.g., MNIST expects 28x28 grayscale) 3. **Plan weight extraction format** - Decide on intermediate format (JSON, binary, etc.) - Note that PyTorch stores linear layer weights as `[out_features, in_features]` - Account for any transposition needed during matrix multiplication ### Phase 2: Weight Extraction 1. **Create a weight extraction scr
- Overview
- Workflow
- Phase 1: Analysis and Planning
- Phase 2: Weight Extraction
- Phase 3: Native Implementation
- Phase 4: Verification
- Common Pitfalls
- Weight Dimension Confusion
- Image Preprocessing Errors
- Premature Cleanup
- Incomplete File Writes
- Verification Checklist
- Resources
- references/
What does the pytorch-model-cli skill do?
Guidance for implementing CLI tools that perform inference using PyTorch models in native languages (C/C++/Rust). This skill should be used when tasks involve extracting weights from PyTorch .pth files, implementing neural network forward passes in C/C++, or creating standalone inference tools without Python dependencies.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill pytorch-model-cli --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 majiayu000/claude-skill-registry, a repository with 534 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.
