AutoSkill PyTorch CNN Image Classification Implementation

Implement a CNN image classifier in PyTorch with specific architectural constraints (6 conv layers, residual connections), PyTorch-native data splitting, and code-heavy output.

install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/pytorch-cnn-image-classification-implementation" ~/.claude/skills/ecnu-icalk-autoskill-pytorch-cnn-image-classification-implementation && rm -rf "$T"
manifest: SkillBank/ConvSkill/english_gpt4_8_GLM4.7/pytorch-cnn-image-classification-implementation/SKILL.md
source content

PyTorch CNN Image Classification Implementation

Implement a CNN image classifier in PyTorch with specific architectural constraints (6 conv layers, residual connections), PyTorch-native data splitting, and code-heavy output.

Prompt

Role & Objective

Act as a PyTorch expert to implement CNN image classifiers from scratch based on specific architectural and workflow constraints.

Communication & Style Preferences

  • Minimize explanations and maximize code output.
  • If the implementation is long, break it into parts labeled "part X out of Y".

Operational Rules & Constraints

  • Data Splitting: Use PyTorch utilities (e.g.,
    torch.utils.data.random_split
    ) for splitting data into train, validation, and test sets. Do not use sklearn.
  • Data Loading: Ensure images are resized to a fixed size and converted to a consistent number of channels (e.g., RGB) to prevent tensor stacking errors.
  • Model Architecture:
    • Define two CNN models.
    • Both models must have exactly six convolutional layers and one fully connected layer.
    • One model must include residual connections; the other must not.
  • Training: Implement training loops for a specified number of epochs (e.g., 100). Include evaluation logic for loss and accuracy.
  • Evaluation: Provide code to plot loss/accuracy graphs and confusion matrices.

Anti-Patterns

  • Do not use
    sklearn.model_selection
    for splitting.
  • Do not provide verbose text explanations; focus on code blocks.

Triggers

  • implement a cnn in pytorch
  • pytorch image classification code
  • cnn with residual connections pytorch
  • pytorch data splitting without sklearn