Agent SkillsECNU-ICALK/AutoSkill › PyTorch Tensor Shape Debugging

PyTorch Tensor Shape Debugging

GitHub

用于调试PyTorch模型中的维度不匹配错误,通过在关键位置添加打印语句来检查张量形状。

SkillBank/ConvSkill/english_gpt4_8_GLM4.7/pytorch-tensor-shape-debugging/SKILL.md ECNU-ICALK/AutoSkill

Trigger Scenarios

debug tensor shapes figure out the source of the dimension problem

Install

npx skills add ECNU-ICALK/AutoSkill --skill PyTorch Tensor Shape Debugging -g -y
More Options

Non-standard path

npx skills add https://github.com/ECNU-ICALK/AutoSkill/tree/main/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/pytorch-tensor-shape-debugging -g -y

Use without installing

npx skills use ECNU-ICALK/AutoSkill@PyTorch Tensor Shape Debugging

指定 Agent (Claude Code)

npx skills add ECNU-ICALK/AutoSkill --skill PyTorch Tensor Shape Debugging -a claude-code -g -y

安装 repo 全部 skill

npx skills add ECNU-ICALK/AutoSkill --all -g -y

预览 repo 内 skill

npx skills add ECNU-ICALK/AutoSkill --list

SKILL.md

Frontmatter
{
    "id": "8b93986d-15e0-4a54-8a17-c966b075c738",
    "name": "PyTorch Tensor Shape Debugging",
    "tags": [
        "pytorch",
        "debugging",
        "tensor shapes",
        "dimension mismatch",
        "neural networks"
    ],
    "version": "0.1.0",
    "triggers": [
        "track and inspect all the variables in the code",
        "debug tensor shapes",
        "figure out the source of the dimension problem",
        "add print statements to check shapes"
    ],
    "description": "Debugs PyTorch dimension mismatch errors by adding print statements to inspect tensor shapes at key points in the model forward pass and training loop."
}

PyTorch Tensor Shape Debugging

Debugs PyTorch dimension mismatch errors by adding print statements to inspect tensor shapes at key points in the model forward pass and training loop.

Prompt

Role & Objective

You are a PyTorch debugging assistant. Your task is to help identify tensor dimension mismatches in neural network code by tracking and inspecting variable shapes.

Operational Rules & Constraints

When a user encounters a dimension mismatch error (e.g., "Tensors must have same number of dimensions"), you must add debugging print statements to the code to inspect the shapes of tensors at critical points.

  1. Training Loop Inspection: Add print statements to show the shape of the data tensor, inputs, targets (before and after reshaping), and model outputs (before and after reshaping).
  2. Model Forward Pass Inspection: Inside the model's forward method, add print statements to show:
    • The shape of the input sequence at entry.
    • The shape of the state (if applicable).
    • The shape of intermediate tensors inside loops (e.g., after splitting, after concatenation, after linear layers).
    • The shape of the final output tensor before returning.

Communication & Style Preferences

  • Present the modified code with the added print statements clearly.
  • Explain that these prints will help trace where the shape divergence occurs.

Anti-Patterns

  • Do not attempt to fix the code without first inspecting the shapes if the user specifically requests to "track and inspect all the variables".
  • Do not remove existing logic unless it is clearly the cause of the error.

Triggers

  • track and inspect all the variables in the code
  • debug tensor shapes
  • figure out the source of the dimension problem
  • add print statements to check shapes

Version History

  • 94c47ca Current 2026-07-24 15:24

Same Skill Collection

SkillBank/Common/anthropics-skill/algorithmic-art/SKILL.md
SkillBank/Common/anthropics-skill/brand-guidelines/SKILL.md
SkillBank/Common/anthropics-skill/canvas-design/SKILL.md
SkillBank/Common/anthropics-skill/doc-coauthoring/SKILL.md
SkillBank/Common/anthropics-skill/frontend-design/SKILL.md
SkillBank/Common/anthropics-skill/internal-comms/SKILL.md
SkillBank/Common/anthropics-skill/mcp-builder/SKILL.md
SkillBank/Common/anthropics-skill/pdf/SKILL.md
SkillBank/Common/anthropics-skill/skill-creator/SKILL.md
SkillBank/Common/anthropics-skill/slack-gif-creator/SKILL.md
SkillBank/Common/anthropics-skill/theme-factory/SKILL.md
SkillBank/Common/anthropics-skill/web-artifacts-builder/SKILL.md
SkillBank/Common/anthropics-skill/webapp-testing/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/artifacts-builder/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/brand-guidelines/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/canvas-design/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/changelog-generator/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/competitive-ads-extractor/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/connect-apps/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/connect/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/content-research-writer/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/developer-growth-analysis/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/domain-name-brainstormer/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/file-organizer/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/image-enhancer/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/internal-comms/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/invoice-organizer/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/lead-research-assistant/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/mcp-builder/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/meeting-insights-analyzer/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/raffle-winner-picker/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/slack-gif-creator/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/tailored-resume-generator/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/theme-factory/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/twitter-algorithm-optimizer/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/webapp-testing/SKILL.md
SkillBank/Common/AwesomeClaudeSkills/youtube-downloader/SKILL.md
SkillBank/Common/baoyu-skills/baoyu-article-illustrator/SKILL.md
SkillBank/Common/baoyu-skills/baoyu-comic/SKILL.md
SkillBank/Common/baoyu-skills/baoyu-compress-image/SKILL.md
SkillBank/Common/baoyu-skills/baoyu-cover-image/SKILL.md
SkillBank/Common/baoyu-skills/baoyu-danger-gemini-web/SKILL.md
SkillBank/Common/baoyu-skills/baoyu-danger-x-to-markdown/SKILL.md
SkillBank/Common/baoyu-skills/baoyu-format-markdown/SKILL.md
SkillBank/Common/baoyu-skills/baoyu-image-gen/SKILL.md
SkillBank/Common/baoyu-skills/baoyu-infographic/SKILL.md
SkillBank/Common/baoyu-skills/baoyu-markdown-to-html/SKILL.md
SkillBank/Common/baoyu-skills/baoyu-post-to-wechat/SKILL.md
SkillBank/Common/baoyu-skills/baoyu-post-to-x/SKILL.md
SkillBank/Common/baoyu-skills/baoyu-slide-deck/SKILL.md

Metadata

Files
0
Version
94c47ca
Hash
06f862ea
Indexed
2026-07-24 15:24

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-16 18:19
浙ICP备14020137号-1 $mapa de visitantes$