torch-profile

torch-profile is a skill for Claude Code from wenhaochai/claude-plugins. It costs 86 tokens per session (1,471 once invoked), scanned A, original, MIT.

A profiling and diagnosis workflow for PyTorch training or inference. PyTorch is a machine-learning framework; its profiler records where a program spends time and memory, then this workflow traces findings back to exact code locations without changing the job itself.

In plain words
What is it for?
Use it to measure a job, inspect how time is divided, identify root causes, and report file-and-line findings for someone else to fix.
Why use it?
It separates real startup and execution costs from the extra delay caused by profiling, and distinguishes bottlenecks from symptoms that are not causing the problem.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the who-ate-my-flops plugin — 9 skills shipped together

Good fit Use it to measure a job, inspect how time is divided, identify root causes, and report file-and-line findings for someone else to fix.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/wenhaochai/claude-plugins/torch-profile
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 wenhaochai/claude-plugins --skill torch-profile
Clone the repo
git clone --depth 1 https://github.com/wenhaochai/claude-plugins

Made for: Claude Code.

Or install who-ate-my-flops, the plugin that ships this one along with the rest of its 9 skills.

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 torch-profile

README.md
[![agentmods](https://agentmods.dev/badge/skills/wenhaochai/claude-plugins/torch-profile/github.svg)](https://agentmods.dev/skills/wenhaochai/claude-plugins/torch-profile)
Your own site
<a href="https://agentmods.dev/skills/wenhaochai/claude-plugins/torch-profile"><img src="https://agentmods.dev/badge/skills/wenhaochai/claude-plugins/torch-profile/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 torch-profile

Your own site · 80×15
<a href="https://agentmods.dev/skills/wenhaochai/claude-plugins/torch-profile"><img src="https://agentmods.dev/badge/skills/wenhaochai/claude-plugins/torch-profile.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 86 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,471 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.00086 $0.01471
Opus 5.5 $0.00034 $0.00588
Sonnet 5.5 $0.00017 $0.00294
Haiku 4.5 $0.00009 $0.00147

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

Security

Grade A, and why

torch-profile 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 14d 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.

who-ate-my-flops/skills/torch-profile/SKILL.md · 121 lines

How it starts

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

How is the time distributed? Where is the bottleneck? What is not the problem? Every finding gets chased to a file:line.

torch-profile

  • Profile the script at the current commit with torch.profiler.
  • Add the profiler hooks yourself when the script has none.
  • What you produce is a diagnosis, not a patch. Those hooks are the only edit you make: nothing here changes what the job computes or how long it takes, and nothing here measures a fix.
① capture                ② views                ③ findings
   one plain run +    →     how the wall      →    ranked, anchored,
   a profiled window        actually splits        costed, handed off

① Capture

Two runs.

First, unprofiled: torch.profiler adds overhead, so take the honest clock with the cheap APIs instead, such as torch.cuda.Event(enable_timing=True) and torch.cuda.max_memory_allocated(). This is also the only run that sees startup, which no profiling window covers: dataset preprocessing, checkpoint loading, first-step compilation, and anything else paid once. Time every step, and save both that series and those startup numbers under commits/<sha>/.

Then profiled, over about 3 steady-state steps, with the window chosen from the step-time series the first run produced. Steps 3-4-5 is a default, not a law: if records/execution_schedule.json marks a periodic phase, the window must not straddle it, and if step time trends, the window has to sit in the regime the run actually spends its steps in. Traces go under commits/<sha>/trace/, which workspace.py candidate <ws> <sha> creates.

② Views

One profiled step can hold a million events, and nobody reads a million events. A view is a reshaping that makes one kind of anomaly stand out and hides the rest. tools/view/ loads the traces into a store, then renders all five from it, one numbered file each:

export PYTHONPATH=<plugin root>   # you are standing in the target, not here
python -m tools.view load   <ws>/commits/<sha>/trace/*.json -o <ws>/commits/<sha>/store.db
python -m tools.view render <ws>/commits/<sha>/store.db -o <ws>/commits/<sha>/views --capacity-gb <GB>

Read the full file on GitHub · 121 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. 14d ago Changed · +36 tokens per session 49900528bff7
  2. 17d ago First seen · 121 lines · 50 tokens per session scan A 655eff64268c

Subscribe to this mod's changes

torch-profile is a skill published in the GitHub repository wenhaochai/claude-plugins (17 stars, last pushed 2d ago), licensed MIT. It adds 86 tokens to every session and 1,471 once invoked, about $0.0003 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-01.

Related

Other skills, from other repositories

debug-optimize-lcp

Guides debugging and optimizing Largest Contentful Paint (LCP) using Chrome DevTools MCP tools. Use this skill whenever the user asks about LCP performance, slow page loads, Core Web Vitals optimization, or wants to understand why their page's main content takes too long to appear. Also use when the user mentions…

ChromeDevTools/chrome-devtools-mcp · 99 tokens

systematic-debugging

Use when debugging a failing test, build error, or runtime issue that isn't immediately obvious. Guides a 4-phase root cause analysis instead of random fix attempts.

open-metadata/OpenMetadata · 37 tokens

diagnose

Trace from a reproduced symptom to the source code that causes it. Pin the specific file and approximate line, rate confidence in the cause and clarity of the fix independently, and always propose a concrete fix.

emdash-cms/emdash · 43 tokens

repro-admin

Reproduce an EmDash admin UI bug. Attach a container, start the demo dev server, drive the admin with agent-browser using the dev-bypass session, and capture the reproduction as screenshots plus a replayable transcript.

emdash-cms/emdash · 48 tokens

log-error-digest

Analyze log files to troubleshoot errors, identify peak error periods, and produce error clustering, frequency statistics, and time distribution reports. Supports JSON, syslog, and Nginx formats with automatic detection. Use when a user uploads a .log file and asks to analyze errors, find patterns, debug issues, or…

zebbern/claude-code-guide · 71 tokens

deck-retro

Run a fully local agent-deck retrospective over the user's own transcripts, Recall index and logs. Use when a user wants to find recurring failures or take their own finding from investigation through synthetic reproduction, a user-filed issue, a test-first fix and contributor PR handoff. Also use for weekly usage…

asheshgoplani/agent-deck · 86 tokens