pytorch

pytorch is a skill for Claude Code, Codex from G1Joshi/Agent-Skills. It costs 39 tokens per session (1,445 once invoked), scanned A, original, MIT.

A guide to PyTorch, a Python framework for building and training neural networks, which are computer models that learn from data.

In plain words
What is it for?
Use it for AI research, neural-network training, model compilation, attention-based models, and managing computation across devices or multiple GPUs.
Why use it?
It provides a common way to experiment with models, inspect them during execution, and prepare them for faster production use.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for AI research, neural-network training, model compilation, attention-based models, and managing computation across devices or multiple GPUs.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/g1joshi/agent-skills/pytorch
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add G1Joshi/Agent-Skills --skill pytorch
Clone the repo
git clone --depth 1 https://github.com/G1Joshi/Agent-Skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pytorch

README.md
[![agentmods](https://agentmods.dev/badge/skills/g1joshi/agent-skills/pytorch/github.svg)](https://agentmods.dev/skills/g1joshi/agent-skills/pytorch)
Your own site
<a href="https://agentmods.dev/skills/g1joshi/agent-skills/pytorch"><img src="https://agentmods.dev/badge/skills/g1joshi/agent-skills/pytorch/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pytorch

Your own site · 80×15
<a href="https://agentmods.dev/skills/g1joshi/agent-skills/pytorch"><img src="https://agentmods.dev/badge/skills/g1joshi/agent-skills/pytorch.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 39 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,445 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00039 $0.01445
Opus 5.5 $0.00016 $0.00578
Sonnet 5.5 $0.00008 $0.00289
Haiku 4.5 $0.00004 $0.00145

Measured 23d ago against content hash 69c9265fb26d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

pytorch scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 23d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/ai-ml/pytorch/SKILL.md · 174 lines

How it starts

The opening of the file, as written. The whole thing — 174 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PyTorch

PyTorch is the foundational deep learning framework for research and production, featuring dynamic computational graphs, torch.compile graph optimization, and distributed GPU training.

When to Use

  • State-of-the-Art Deep Learning Research & Production: Training vision, NLP, audio, and generative AI models.
  • Model Compilation with torch.compile(): Accelerating model inference and training via TorchDynamo and Triton kernels.
  • Distributed Training (DDP / FSDP): Scaling models across multi-GPU and multi-node clusters.
  • Hardware Acceleration: Training and executing on NVIDIA CUDA, Apple Silicon MPS, and AMD ROCm.

Quick Start

import torch
import torch.nn as nn

# Define simple neural network
class MLP(nn.Module):
    def __init__(self):
        super().__init__()
        self.net = nn.Sequential(
            nn.Linear(20, 64),
            nn.ReLU(),
            nn.Linear(64, 2)
        )

    def forward(self, x):
        return self.net(x)

device = "cuda" if torch.cuda.is_available() else "cpu"
model = MLP().to(device)
criterion = nn.CrossEntropyLoss()
optimizer = torch.optim.AdamW(model.parameters(), lr=1e-3)

Core Concepts

Modern Neural Network Module with torch.compile

Defining architectures and compiling with TorchDynamo:

import torch
import torch.nn as nn
import torch.nn.functional as F

class TransformerClassifier(nn.Module):
    def __init__(self, vocab_size: int, embed_dim: int, num_classes: int):
        super().__init__()
        self.embedding = nn.Embedding(vocab_size, embed_dim)
        self.encoder_layer = nn.TransformerEncoderLayer(
            d_model=embed_dim, nhead=4, dim_feedforward=256, batch_first=True
        )
        self.transformer = nn.TransformerEncoder(self.encoder_layer, num_layers=2)
        self.fc = nn.Linear(embed_dim, num_classes)

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        embedded = self.embedding(x)
        encoded = self.transformer(embedded)
        pooled = encoded.mean(dim=1) # Global average pooling
        return self.fc(pooled)

device = torch.device("cuda" if torch.cuda.is_available() else ("mps" if torch.backends.mps.is_available() else "cpu"))
model = TransformerClassifier(vocab_size=10000, embed_dim=128, num_classes=5).to(device)

# PyTorch 2.x JIT compilation for Triton / GPU optimization
if torch.cuda.is_available():
    compiled_model = torch.compile(model)
else:
    compiled_model = model

Read the full file on GitHub · 174 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 23d ago Changed · +5 lines 69c9265fb26d
  2. 27d ago Changed · +123 lines · +22 tokens per session 6257bc7589a3
  3. 1mo ago First seen · 46 lines · 17 tokens per session scan A 995cc5717c41

Subscribe to this mod's changes

pytorch is a skill published in the GitHub repository G1Joshi/Agent-Skills (15 stars, last pushed 24d ago), licensed MIT. It adds 39 tokens to every session and 1,445 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.