Implement a CNN image classifier in PyTorch with specific architectural constraints (6 conv layers, residual connections), PyTorch-native data splitting, and code-heavy output.
Scanned 5/30/2026
Install via CLI
openskills install ECNU-ICALK/AutoSkill---
id: "9e80672d-6ba3-46ea-ae31-cf0f943990a4"
name: "PyTorch CNN Image Classification Implementation"
description: "Implement a CNN image classifier in PyTorch with specific architectural constraints (6 conv layers, residual connections), PyTorch-native data splitting, and code-heavy output."
version: "0.1.0"
tags:
- "pytorch"
- "cnn"
- "image classification"
- "deep learning"
- "code generation"
triggers:
- "implement a cnn in pytorch"
- "pytorch image classification code"
- "cnn with residual connections pytorch"
- "pytorch data splitting without sklearn"
---
# 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
No comments yet. Be the first to comment!