torch-performance-optimization

torch-performance-optimization is a skill for Codex from albumentations-team/albucore. It costs 60 tokens per session (538 once invoked), scanned A, original, MIT.

A procedure for improving CPU-only PyTorch code used with image-processing operations. It requires correctness checks and end-to-end benchmarks before selecting an implementation.

In plain words
What is it for?
Reviewing or changing Torch CPU kernels, NumPy-to-Torch data paths, tensor layouts, threading, memory use, backend selection, and performance benchmarks.
Why use it?
It prevents a change from appearing faster in isolation while becoming slower through data conversion, memory layout changes, extra allocations, or other surrounding work.

Skill for Codex

Written for Codex: agents/openai.yaml present.

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.

agentmods
npx agentmods add skills/albumentations-team/albucore/torch-performance-optimization
Any agent
npx skills add albumentations-team/albucore --skill torch-performance-optimization
Clone the repo
git clone --depth 1 https://github.com/albumentations-team/albucore

Made for: 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 torch-performance-optimization

README.md
[![agentmods](https://agentmods.dev/badge/skills/albumentations-team/albucore/torch-performance-optimization.svg)](https://agentmods.dev/skills/albumentations-team/albucore/torch-performance-optimization)
Your own site
<a href="https://agentmods.dev/skills/albumentations-team/albucore/torch-performance-optimization"><img src="https://agentmods.dev/badge/skills/albumentations-team/albucore/torch-performance-optimization.svg" alt="Measured on agentmods" height="20"></a>
Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 538 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00060 $0.00538
Opus 5 $0.00030 $0.00269
Sonnet 5 $0.00012 $0.00108
Haiku 4.5 $0.00006 $0.00054

Measured 6d ago against content hash a6f894d2da0d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

torch-performance-optimization 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 6d 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.

.codex/skills/torch-performance-optimization/SKILL.md · 30 lines

How it starts

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

Torch Performance Optimization

Read docs/torch-performance-optimization.md completely before inspecting or editing a Torch path. Also read ../performance-optimization/SKILL.md, its canonical performance guide, and ../albucore-benchmarks/SKILL.md completely.

Workflow

  1. Establish a correctness baseline and benchmark the existing public path. State container, layout, dtype, shape, parameter, stride, thread, and allocation contracts.
  2. Audit unnecessary Python work, full-volume passes, conversions, materializations, and output repairs before choosing a Torch operator.
  3. Profile only to discover candidates. Benchmark every viable implementation end to end, including NumPy↔Torch bridges and layout conversion.
  4. Compare NumPy, OpenCV, NumKong, StringZilla, and Torch where they share semantics. Treat fused operators, layout, channels_last_3d, and in-place reuse as hypotheses with their own correctness and performance matrices.
  5. Select a route or threshold only from stable public-path evidence. Preserve rejected candidates in the benchmark report when they clarify a boundary.
  6. Add correctness tests for each accepted route and update the benchmark evidence, public contract, and canonical guide when a reusable rule or limitation is discovered.

Albucore Contract

  • Torch is a required dependency. Assume it is already imported for benchmarks.
  • Current public Tensor routes are eager CPU paths that do not record autograd inside the primitive and do not use torch.compile. Do not add device routes, graph-preserving primitive fallbacks, compilation, or their benchmark candidates.
  • Tensor layouts are explicit and independent of NumPy layouts. Do not infer NCHW versus CDHW from shape sizes.
  • Caller-prevalidated 3D routers leave validation outside the hot path. Do not add it back while optimizing.
  • A Tensor route must preserve the documented container, layout, border, interpolation, rounding, mutation, and aliasing behavior. Its dtype contract must distinguish supported dtype preservation from any explicit fallback conversion.

Read the full file on GitHub · 30 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 6d ago First seen · 30 lines · 60 tokens per session scan A a6f894d2da0d

Subscribe to this mod's changes

torch-performance-optimization is a skill published in the GitHub repository albumentations-team/albucore (123 stars, last pushed 8d ago), licensed MIT. It adds 60 tokens to every session and 538 once invoked, about $0.0003 per session on Opus 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.

Related

Other skills, from other repositories

hailo-optimize

Optimize and quantize a parsed Hailo HAR using the Hailo Dataflow Compiler (DFC). Auto-loads a matching ALLS model script from the Model Zoo, prepares calibration data (with the correct normalization alignment), runs optimization on GPU when available, and gates on the post-optimize SNR.

hailo-ai/hailo_model_zoo · 67 tokens

hailo-parse

Parse an ONNX or TensorFlow model into a Hailo HAR using the Hailo Dataflow Compiler (DFC). Use when bringing a new model into the Hailo flow. Auto-discovers parser start/end nodes and normalization from the Model Zoo when the model name matches a known network.

hailo-ai/hailo_model_zoo · 65 tokens

hailo-compile

Compile an optimized Hailo HAR into a HEF binary using the Hailo Dataflow Compiler (DFC). Final stage of the DFC flow — takes the quantized HAR from /hailo-optimize and produces a deployable .hef.

hailo-ai/hailo_model_zoo · 55 tokens

Computer Vision Helper

Assist with image analysis, object detection, and visual AI tasks.

eddiebelaval/squire · 16 tokens

ml-for-aec

Computer vision for buildings, image-to-floorplan, generative ML models, performance prediction, structural analysis ML, energy prediction, natural language to design, and point cloud ML for AEC computational design.

Abhinavbwj/Claude-skills-for-Computational-Designers · 39 tokens

dataset-profiling

Use as the FIRST step of any ML task, before choosing a model, to inspect and understand the actual dataset. Works for a LOCAL dataset (Claude reads the files directly) and for a KAGGLE dataset (Claude cannot read /kaggle/input from your machine, so it emits a small profiling cell you run on Kaggle and paste back, or…

mxslr/mlcraft · 150 tokens