N Neurarch Architectures Checks Docs Open the app

Architectures / Computer Vision

🖼️ Simple CNN

Simple Convolutional Neural Network for image classification

Layers
9
Parameters
804.6K
Input
1 × 28 × 28
Output
10
Verifier
Clean

Every number on this page is computed from the graph by the same functions the app runs, not written by hand.

Open Simple CNN on the canvas Free, no account needed

When to pick it

Pick as a fast baseline for small images (≤64px, e.g. CIFAR). Trains in minutes, easy to debug — use before reaching for ResNet.

Structure

9 layers. Output shapes are propagated from the input shape, batch dimension excluded.

LayerTypeParametersOutput shape
1InputInputshape=[1, 28, 28]1 × 28 × 28
2Conv2D_1Conv2DoutChannels=32, kernelSize=3, stride=132 × 28 × 28
3ReLU_1ReLU32 × 28 × 28
4MaxPool2D_1MaxPool2DkernelSize=2, stride=232 × 14 × 14
5FlattenFlatten6272
6Linear_1LinearoutFeatures=128128
7ReLU_2ReLU128
8Linear_2LinearoutFeatures=1010
9OutputOutput10

What the verifier says

The same 41 structural checks that run on every edit in the app, on this graph.

info7 layers with no BatchNorm, LayerNorm, or GroupNorm. Without normalization, activations can explode or vanish across layers, causing slow or unstable training. Fix: Add BatchNorm after Conv2d (CV tasks), LayerNorm after attention/FFN (NLP/LLM), or GroupNorm for small batch sizes.
deep-no-norm

The PyTorch it exports

Generated from the graph above.

# Architecture designed with Neurarch: https://neurarch.com
# PyTorch: compatible with Python 3.8+ and torch>=1.12
# Colab: pip install torch torchvision  (usually pre-installed)

import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Tuple

class SimpleCNN(nn.Module):
    def __init__(self):
        super().__init__()

        self.conv2d_1 = nn.Conv2d(1, 32, kernel_size=3, stride=1, padding=1)
        self.maxpool2d_1 = nn.MaxPool2d(kernel_size=2, stride=2, padding=0)
        self.linear_1 = nn.Linear(6272, 128)
        self.linear_2 = nn.Linear(128, 10)

    def forward(self, x):
        # Input shape: [1,28,28]
        conv2d_nv2d_1 = self.conv2d_1(x)
        relu_relu_1 = F.relu(conv2d_nv2d_1)
        maxpool2d_ol2d_1 = self.maxpool2d_1(relu_relu_1)
        flatten_tten_1 = torch.flatten(maxpool2d_ol2d_1, 1)
        linear_near_1 = self.linear_1(flatten_tten_1)
        relu_relu_2 = F.relu(linear_near_1)
        linear_near_2 = self.linear_2(relu_relu_2)
        # Output
        return linear_near_2


if __name__ == '__main__':
    model = SimpleCNN()
    model.eval()

    x = torch.randn(1, 28, 28)  # (batch, seq_len, embed_dim)
    with torch.no_grad():
        output = model(x)

    print(f'Input  shape : {tuple(x.shape)}')
    print(f'Output shape : {tuple(output.shape)}')
    total = sum(p.numel() for p in model.parameters())
    trainable = sum(p.numel() for p in model.parameters() if p.requires_grad)
    print(f'Parameters   : {total:,} total, {trainable:,} trainable')

For agents

This architecture is machine-readable end to end. An agent can list the set, fetch this graph, edit it, and have the edit verified before any GPU time is spent.

Also in Computer Vision

🔗 ResNet Block
ResNet residual block with skip connections
9 layers · 74.0K
🩻 U-Net
Encoder-decoder with skip connections — Ronneberger et al
24 layers · 720.7K
👁️ ViT-B/16
Vision Transformer — patch embedding stem + 1 encoder block
13 layers · 8.45M
🪟 Swin-Tiny
Hierarchical vision transformer — shifted-window attention builds a feature pyramid for dense prediction
81 layers · 28.26M