pypto-case-norm-layernorm

pypto-case-norm-layernorm is a skill for Claude Code, Codex from mindspore-ai/akg. It costs 42 tokens per session (539 once invoked), scanned A, original, Apache-2.0.

A PyPTO example of LayerNorm, which normalizes each row of values using that row’s mean and variance. It flattens each input item to two dimensions, processes rows in groups, and restores the original shape.

In plain words
What is it for?
Use it for LayerNorm or similarly shaped GroupNorm operations where each row or group must be normalized independently.
Why use it?
It provides a concrete pattern for combining sums, variance calculation, normalization, looping, and writing results back to the output.

Skill for Claude CodeCodex

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

Good fit Use it for LayerNorm or similarly shaped GroupNorm operations where each row or group must be normalized independently.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mindspore-ai/akg/pypto-case-norm-layernorm
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 mindspore-ai/akg --skill pypto-case-norm-layernorm
Clone the repo
git clone --depth 1 https://github.com/mindspore-ai/akg

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 pypto-case-norm-layernorm

README.md
[![agentmods](https://agentmods.dev/badge/skills/mindspore-ai/akg/pypto-case-norm-layernorm/github.svg)](https://agentmods.dev/skills/mindspore-ai/akg/pypto-case-norm-layernorm)
Your own site
<a href="https://agentmods.dev/skills/mindspore-ai/akg/pypto-case-norm-layernorm"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/pypto-case-norm-layernorm/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 pypto-case-norm-layernorm

Your own site · 80×15
<a href="https://agentmods.dev/skills/mindspore-ai/akg/pypto-case-norm-layernorm"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/pypto-case-norm-layernorm.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 539 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00042 $0.00539
Opus 5 $0.00021 $0.00269
Sonnet 5 $0.00008 $0.00108
Haiku 4.5 $0.00004 $0.00054

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

Security

Grade A, and why

pypto-case-norm-layernorm 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 11d 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.

akg_agents/python/akg_agents/op/resources/skills/pypto/cases/pypto-case-norm-layernorm/SKILL.md · 47 lines

What it actually says

模式 C-1:2D Norm — LayerNorm

forward 中 reshape(batch, -1) 降为 2D,kernel 沿 batch 维 loop。

BASIC_BATCH = 4

def create_layernorm_kernel(batch, hidden, eps):
    @pypto.frontend.jit(runtime_options=..., debug_options=...)
    def kernel(
        x: pypto.Tensor((batch, hidden), pypto.DT_FP32),
    ) -> pypto.Tensor((batch, hidden), pypto.DT_FP32):
        output = pypto.tensor([batch, hidden], pypto.DT_FP32)
        num_iters = ceil_div(batch, BASIC_BATCH)
        pypto.set_vec_tile_shapes(1, 16384)
        inv_h = 1.0 / hidden
        for bi in pypto.loop(0, num_iters, 1, name="LOOP_LN", idx_name="bi"):
            offset = bi * BASIC_BATCH
            x_chunk = pypto.view(x, [BASIC_BATCH, hidden], [offset, 0])
            mean = pypto.sum(x_chunk, dim=1, keepdim=True) * inv_h
            var = pypto.sum(x_chunk * x_chunk, dim=1, keepdim=True) * inv_h - mean * mean
            normed = (x_chunk - mean) / pypto.sqrt(var + eps)
            pypto.assemble(normed, [offset, 0], output)
        return output
    return kernel

forward:reshape(B, -1) → kernel → reshape(x.shape) GroupNorm 同模式:forward 中 reshape(B*G, -1) → 2D kernel。

模式要点

  • pypto.sum(dim=int) — dim 只能传单个 int
  • mean = sum * (1/size) — 没有 mean API
  • 方差 = E[x²] - E[x]² — 两次 sum 实现
  • set_vec_tile_shapes(1, 16384) — 2D,第一维小批量,第二维大 tile
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. 11d ago First seen · 47 lines · 42 tokens per session scan A 5f761d0a759f

Subscribe to this mod's changes

pypto-case-norm-layernorm is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 42 tokens to every session and 539 once invoked, about $0.0002 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

triton-cuda-examples-torch

A set of complete examples showing how Triton CUDA kernels work inside PyTorch, including vector addition, matrix multiplication, layer normalization, and softmax.

wenyi-li/awesome-agent-kernel-skills · 71 tokens

triton-ascend-examples-mindspore

Integration examples for using Triton Ascend kernels inside MindSpore, a machine-learning framework. They show how to register a custom operation and pass tensors in and out.

wenyi-li/awesome-agent-kernel-skills · 75 tokens

pypto-case-norm-batchnorm

A worked example of BatchNorm, a machine-learning step that normalizes values in groups, for three-dimensional data. It demonstrates reducing dimensions, summing across several axes, and copying values across expanded dimensions.

wenyi-li/awesome-agent-kernel-skills · 41 tokens

pypto-case-loss-crossentropy

An example of implementing cross-entropy loss, a calculation commonly used to measure classification errors. It covers multiple inputs, tiled processing, softmax, selecting target values, summing, and producing one scalar result.

wenyi-li/awesome-agent-kernel-skills · 37 tokens

pypto-case-norm-layernorm

A PyPTO example showing how LayerNorm normalises values across a two-dimensional input using a loop. LayerNorm is a machine-learning operation that rescales values to help a model process them consistently.

wenyi-li/awesome-agent-kernel-skills · 42 tokens

pypto-case-elemwise-gelu

A PyPTO example for applying the GELU activation function element by element to a one-dimensional array. It demonstrates flattening, a hand-written formula without tanh, and operator use.

wenyi-li/awesome-agent-kernel-skills · 40 tokens