deep-learning-pytorch

deep-learning-pytorch is a skill for Claude Code, Codex from makifbaysal/tasktrooper. It costs 55 tokens per session (1,981 once invoked), scanned A, original, Apache-2.0.

Guidance for writing and changing PyTorch code, a Python library for training neural networks. It covers models, data loading, training and evaluation, repeatable runs, mixed-precision training, saved models, Hugging Face models, ONNX export, and CPU tests.

In plain words
What is it for?
Use it to build or modify PyTorch models, data loaders, training loops, evaluation code, checkpoints, and export paths. It also helps keep the CPU version as the tested baseline when adding GPU-related options.
Why use it?
Deep-learning code can give improving results while being wired incorrectly, such as evaluating with training behavior enabled or using test data to calculate normalisation values. It encourages small testable parts and a tiny-batch check of the training setup.

Skill for Claude CodeCodex

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

Good fit Use it to build or modify PyTorch models, data loaders, training loops, evaluation code, checkpoints, and export paths. It also helps keep the CPU version as the tested baseline when adding GPU-related options.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/makifbaysal/tasktrooper/deep-learning-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 makifbaysal/tasktrooper --skill deep-learning-pytorch
Clone the repo
git clone --depth 1 https://github.com/makifbaysal/tasktrooper

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 deep-learning-pytorch

README.md
[![agentmods](https://agentmods.dev/badge/skills/makifbaysal/tasktrooper/deep-learning-pytorch/github.svg)](https://agentmods.dev/skills/makifbaysal/tasktrooper/deep-learning-pytorch)
Your own site
<a href="https://agentmods.dev/skills/makifbaysal/tasktrooper/deep-learning-pytorch"><img src="https://agentmods.dev/badge/skills/makifbaysal/tasktrooper/deep-learning-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 deep-learning-pytorch

Your own site · 80×15
<a href="https://agentmods.dev/skills/makifbaysal/tasktrooper/deep-learning-pytorch"><img src="https://agentmods.dev/badge/skills/makifbaysal/tasktrooper/deep-learning-pytorch.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,981 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.00055 $0.01981
Opus 5.5 $0.00022 $0.00792
Sonnet 5.5 $0.00011 $0.00396
Haiku 4.5 $0.00006 $0.00198

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

Security

Grade A, and why

deep-learning-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 4d 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.

catalog/agents/data-scientist/skills/deep-learning-pytorch/SKILL.md · 168 lines

How it starts

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

Deep Learning with PyTorch

Overview

Deep learning bugs rarely crash: a softmax before the loss, dropout left on during evaluation, normalisation statistics computed on the test set — the loss still goes down. Structure the code so each piece is a small function you can test on CPU in a second, and prove the wiring by overfitting one tiny batch.

Core principle: the eager CPU path is the tested path; GPUs, torch.compile and mixed precision are configuration on top of it, never a different code path.

1. Structure

models/net.py        nn.Module, no data loading, no device logic
data/dataset.py      Dataset returning tensors; normalisation stats passed in, fitted on train only
train/loop.py        train_one_epoch(), evaluate(), fit() driven by a config object
pipelines/train.py   entrypoint: config → seed → data → fit → checkpoint → log
def train_one_epoch(model, loader, optimizer, loss_fn, device) -> float:
    model.train()
    total = torch.zeros((), device=device)
    seen = 0
    for xb, yb in loader:
        xb, yb = xb.to(device, non_blocking=True), yb.to(device, non_blocking=True)
        optimizer.zero_grad(set_to_none=True)
        loss = loss_fn(model(xb), yb)
        loss.backward()
        optimizer.step()
        total += loss.detach() * len(xb)
        seen += len(xb)
    return (total / seen).item()

@torch.inference_mode()
def evaluate(model, loader, device) -> tuple[torch.Tensor, torch.Tensor]:
    model.eval()
    logits, targets = [], []
    for xb, yb in loader:
        logits.append(model(xb.to(device)).cpu())
        targets.append(yb)
    return torch.cat(logits), torch.cat(targets)

Accumulating loss.detach() avoids a GPU sync per step that loss.item() forces.

2. Classic bugs

Bug Fix
softmax / sigmoid before CrossEntropyLoss / BCEWithLogitsLoss pass raw logits; the loss applies it
model.eval() missing at evaluation (dropout, batch norm still training) evaluate() always calls eval(); train_one_epoch() always calls train()
Evaluation without inference_mode/no_grad memory grows, slower
Class labels as float for CrossEntropyLoss torch.long class indices
Normalisation mean/std from the full dataset compute on the training split, pass into the Dataset (leakage-safe-feature-engineering)
Gradients accumulating across steps zero_grad(set_to_none=True) every step

Read the full file on GitHub · 168 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. 4d ago First seen · 168 lines · 55 tokens per session scan A 4a79204be253

Subscribe to this mod's changes

deep-learning-pytorch is a skill published in the GitHub repository makifbaysal/tasktrooper (113 stars, last pushed yesterday), licensed Apache-2.0. It adds 55 tokens to every session and 1,981 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-10-09.