mindspore-ai/akg/pypto-case-elemwise-gelu

Claude Code and agent skill by mindspore-ai/akg

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

模式 A 示例:1D elementwise — GELU 激活,展示展平、无 tanh 时的手写公式、运算符使用

Install

npx vskill@latest install mindspore-ai/akg/pypto-case-elemwise-gelu

SKILL.md

The same SKILL.md was published earlier as mindspore-ai/akg/pypto-case-elemwise-gelu.

模式 A:1D Elementwise — GELU

python
def create_gelu_kernel(flat_size):
@pypto.frontend.jit(runtime_options=..., debug_options=...)
def gelu_kernel(
x: pypto.Tensor((flat_size,), pypto.DT_FP32),
) -> pypto.Tensor((flat_size,), pypto.DT_FP32):
output = pypto.tensor([flat_size], pypto.DT_FP32)
pypto.set_vec_tile_shapes(8192)
x_cubed = x * x * x
inner = x + x_cubed * 0.044715
tanh_arg = inner * 0.7978845608028654
exp_pos = pypto.exp(tanh_arg * 2.0)
tanh_val = (exp_pos - 1.0) / (exp_pos + 1.0)
output[:] = x * 0.5 * (1.0 + tanh_val)
return output
return gelu_kernel

forward:reshape(-1) → kernel → reshape(x.shape)

模式要点

  • forward 中 assert dim + shape,reshape(-1) 展平为 1D
  • set_vec_tile_shapes(8192) — 1D 只需一个参数
  • 无内建 tanh → (exp(2x)-1)/(exp(2x)+1) — 注意 exp_pos - 1.0 中 Tensor 在左,合法
  • 所有 Tensor op scalar 合法;若需 scalar op Tensor 则改写

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
259
Repository forks
48
7-day trend score
28

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/mindspore-ai/akg/pypto-case-elemwise-gelu/badge)](https://verified-skill.com/skills/mindspore-ai/akg/pypto-case-elemwise-gelu)

Something wrong with this skill or its page? Tell us.