Agent skill

Torchscan

by frgfm in frgfm/torch-scan

Inspect and compare PyTorch models with TorchScan reports, operator FLOPs, and peak-memory workloads.

Apache-2.0Auto-check passedAI & LLM Engineering

Install Torchscan

skills CLI
$ npx skills add frgfm/torch-scan --skill torchscan -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install frgfm/torch-scan torchscan --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/frgfm/torch-scan.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/torchscan .claude/skills/torchscan && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
torchscan
GitHub stars
223
Token cost
~1k tokens
SKILL.md length
425 words
Files
1
Skills in repo
1
Repo updated
First seen
Licence
Apache-2.0

At a glance

Inspect and compare PyTorch models with TorchScan reports, operator FLOPs, and peak-memory workloads.

  • Works in 6 steps: Reuse the project's model and… → Prefer args and kwargs for real calls;… → Use strict=True when incomplete module… → …
  • An agent must analyze model structure
  • SKILL.md covers Workflow and Truth rules
  • Reaches frgfm.github.io

What it does

Torchscan is an agent skill from frgfm/torch-scan. Inspect and compare PyTorch models with TorchScan reports, operator FLOPs, and peak-memory workloads. Use when an agent must analyze model structure, parameters, compute, memory, regressions, unsupported operations, or an owner-provided model budget without inventing completeness.

Its SKILL.md is about 1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts. Compatibility notes: Requires Python 3.11+, PyTorch 2.1+, and the torchscan package. Accelerator claims require matching real hardware.

It sits in AI & LLM Engineering, covering Deep learning. It works with PyTorch and Python. The repository describes itself as: Seamless analysis of your PyTorch models (RAM usage, FLOPs, MACs, receptive field, etc.). The licence is Apache-2.0.

When your agent uses it

  • An agent must analyze model structure
  • Unsupported operations
  • An owner-provided model budget without inventing completeness

Example prompts

  • “/torchscan”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): Requires Python 3.11+, PyTorch 2.1+, and the torchscan package. Accelerator claims require matching real hardware.

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Reuse the project's model and representative inputs. Do not download weights without permission.
  2. Prefer args and kwargs for real calls; use input_shape only for simple synthetic tensors.
  3. Use strict=True when incomplete module metrics must stop automation.
  4. Serialize the report directly. Never parse the summary table.
  5. Check every metric's status and preserve diagnostics.
  6. Ask the owner for thresholds. TorchScan measures; it does not decide whether a model fits.

What it can do on your machine

Read from SKILL.md and the folder at commit 73fbc11. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • frgfm.github.io

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Requires Python 3.11+, PyTorch 2.1+, and the torchscan package. Accelerator claims require matching real hardware.

    From compatibility in the SKILL.md frontmatter.

Context cost

Torchscan loads about 1k tokens when it runs. Until then it costs about 73 tokens; SKILL.md has 425 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~73
When it runs · the whole SKILL.md, loaded when a task matches
~1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from frgfm/torch-scan at commit 73fbc11, republished under its Apache-2.0 licence (© frgfm). 425 words, ~1,021 tokens.

Download SKILL.mdSave it as .claude/skills/torchscan/SKILL.md (or your agent's skills folder).
name
torchscan
description
Inspect and compare PyTorch models with TorchScan reports, operator FLOPs, and peak-memory workloads. Use when an agent must analyze model structure, parameters, compute, memory, regressions, unsupported operations, or an owner-provided model budget without inventing completeness.
compatibility
Requires Python 3.11+, PyTorch 2.1+, and the torchscan package. Accelerator claims require matching real hardware.
license
Apache-2.0
metadata.author
frgfm
metadata.version
0.2

TorchScan

Use the smallest API that answers the request:

  • crawl_module(...): JSON-serializable module report.
  • summary(...): printed table plus the same report.
  • mode="structure" on either API: hierarchy, shapes, calls, parameters, and buffers with less overhead.
  • measure_flops(workload): operator FLOPs for one zero-argument workload call.
  • measure_peak_memory(workload, device=...): backend-specific PyTorch peak memory.
  • measure_peak_rss(command): Linux/macOS child-process lifetime RSS, including loading and imports.
  • profile_workload(workload, device=...): one instrumented operator diagnostic pass; not clean latency.
  • measure_latency(workload, device=..., inputs=...): first-call time, warmed block-average timing, and explicit work-unit throughput. Unreleased; install main. The callable is invoked repeatedly and owns its state.
  • compare_reports(before, after): pure same-schema comparison.
  • compare_benchmarks(before, after, check=...): compatible workload comparison with an owner-supplied output check.
  • render_report(report): offline model HTML/SVG or benchmark/comparison HTML, without remeasurement.

Workflow

  1. Reuse the project's model and representative inputs. Do not download weights without permission.
  2. Prefer args and kwargs for real calls; use input_shape only for simple synthetic tensors.
  3. Use strict=True when incomplete module metrics must stop automation.
  4. Serialize the report directly. Never parse the summary table.
  5. Check every metric's status and preserve diagnostics.
  6. Ask the owner for thresholds. TorchScan measures; it does not decide whether a model fits.

Truth rules

  • complete: use value with its method, unit, scope, and context.
  • partial: known_value is only a lower bound; do not extrapolate.
  • unavailable: report that no measurement was produced.
  • Zero is valid only with status == "complete".
  • Structure mode's compute totals have method not_requested; strict checks cover requested metrics only.
  • Keep module FLOPs and operator FLOPs separate.
  • Peak PyTorch memory is not process RSS or total device memory.
  • Mocked or skipped CUDA/MPS checks are not hardware evidence.
  • Timing inputs are caller-supplied metadata. Block-average latency is not request p95, and first-call time is not model loading or fresh-process startup. Use compare_benchmarks for timing and compare_reports for model estimates.
  • A passed output check does not establish task accuracy. Failed checks withhold benchmark deltas; IQR labels are descriptive, not statistical significance. Preserve methods, memory scopes, hardware, and raw timing evidence.
Show full SKILL.md (100 more words)Show less

For an uncounted operator, preserve the partial result. Supply custom_mapping to crawl_module, summary, or measure_flops only when the owner can justify that operator's counting convention. For custom module estimates, use per-analysis custom_modules={ModuleType: ModuleHandler(callback)}. Callbacks receive a complete ModuleCall; declare inclusive subtree ownership per metric to avoid double-counting children. Keep the module and operator views separate. Do not create a global registry, baseline store, wrapper service, or automatic budget policy.

In a repository checkout, read ../../../docs/docs/agent-quickstart.md for the full workflow and ../../../docs/docs/report-schema.md for the report contract, and ../../../docs/docs/extensions.md for copyable extension examples. Outside a checkout, use the published documentation at https://frgfm.github.io/torch-scan/.

© frgfm, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/torchscan of frgfm/torch-scan.

Open the folder on GitHubat commit 73fbc11

Compare with similar skills

Torchscan next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Torchscan compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Torchscan this skillfrgfm/torch-scan223—~1kAutomated safety check: PassApache-2.0
Benchmark Pyreflyfacebook/pyrefly7.1k—~1.8kAutomated safety check: PassMIT
Document Public APIspytorch/pytorch104k—~4.2kAutomated safety check: PassCustom licence
ExecuTorch Cortex-M Backendpytorch/executorch5.1k—~872Automated safety check: PassCustom licence
PyTorch Lightning TrainingOrchestra-Research/AI-Research-SKILLs13k7 repos~2.3kAutomated safety check: PassMIT
Ako4allTongmingLAIC/AKO4ALL369—~4kAutomated safety check: PassMIT

Similar skills

  • Benchmark Pyrefly

    facebook/pyrefly

    Official

    Run Pyrefly benchmarks locally via Buck or Cargo, including PyTorch real-world LSP benchmarks.

    7.1k GitHub stars~1.8k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Document Public APIs

    pytorch/pytorch

    Document undocumented public APIs in PyTorch by removing functions from coverageignorefunctions and coverageignoreclasses in docs/source/conf.py, running Sphinx coverage, and adding the appropriate…

    104k GitHub stars~4.2k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • ExecuTorch Cortex-M Backend

    pytorch/executorch

    Developer guide for the Cortex-M (CMSIS-NN) backend in ExecuTorch: quantization pipeline, pass manager, tests and adding new ops.

    5.1k GitHub stars~872 tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • PyTorch Lightning Training

    Orchestra-Research/AI-Research-SKILLs

    Shows how to organize PyTorch training with Lightning's LightningModule and Trainer, covering validation, DDP, callbacks and learning-rate scheduling.

    13k GitHub starsUsed in 7 repos~2.3k tokens
    AI & LLM EngineeringAuto-check passed
  • Ako4all

    TongmingLAIC/AKO4ALL

    Drive an agentic loop that iteratively optimizes a GPU kernel for maximum speedup.

    369 GitHub stars~4k tokensUpdated 23 days ago
    AI & LLM EngineeringAuto-check passed
  • Homepage Generator

    wanshuiyin/ARIS-in-AI-Offer

    Generate a fact-checked academic personal homepage from a CV, optionally augmented by an existing manual homepage and an assets directory.

    580 GitHub stars~4.8k tokensUpdated 2 days ago
    AI & LLM EngineeringAuto-check: notes

Works with

Questions about Torchscan

What does Torchscan do?

Inspect and compare PyTorch models with TorchScan reports, operator FLOPs, and peak-memory workloads. Torchscan is an agent skill from frgfm/torch-scan. Inspect and compare PyTorch models with TorchScan reports, operator FLOPs, and peak-memory workloads.

When should I use Torchscan?

Torchscan fits situations like: an agent must analyze model structure; unsupported operations; an owner-provided model budget without inventing completeness.

How do I install Torchscan in Claude Code?

Run `npx skills add frgfm/torch-scan --skill torchscan -a claude-code`. Or copy the skill folder (.agents/skills/torchscan in frgfm/torch-scan) into .claude/skills/torchscan in your project. Claude Code loads it when a task matches its description.

How do I install Torchscan in Codex?

Run `npx skills add frgfm/torch-scan --skill torchscan -a codex`. Or copy the skill folder (.agents/skills/torchscan in frgfm/torch-scan) into .agents/skills/torchscan in your project. Codex loads it when a task matches its description.

Can I use Torchscan in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add frgfm/torch-scan --skill torchscan -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/torchscan, .gemini/skills/torchscan, .github/skills/torchscan and .opencode/skills/torchscan in your project.

What does Torchscan need to run?

SKILL.md names no scripts, command-line tools or credentials: Torchscan is instructions for the agent only. Our summary lists: Python 3. Compatibility (from SKILL.md): Requires Python 3.11+, PyTorch 2.1+, and the torchscan package. Accelerator claims require matching real hardware..

Does Torchscan access the network?

SKILL.md names 1 domain. In commands or code: frgfm.github.io; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Torchscan safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Torchscan use?

Torchscan is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Torchscan use?

About 1k tokens (SKILL.md is roughly 4.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Torchscan?

Skills that share tags, products or a category with Torchscan: Benchmark Pyrefly (facebook/pyrefly, 7.1k stars), Document Public APIs (pytorch/pytorch, 104k stars), ExecuTorch Cortex-M Backend (pytorch/executorch, 5.1k stars) and PyTorch Lightning Training (Orchestra-Research/AI-Research-SKILLs, 13k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Torchscan?

frgfm (a GitHub user) maintains it in frgfm/torch-scan, which has 223 GitHub stars. The repository was last updated on October 8, 2026.

Source: frgfm/torch-scan on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.