N Neurarch Architectures Checks Docs Open the app

Architectures / Computer Vision

๐Ÿ‘๏ธ ViT-B/16

Vision Transformer โ€” patch embedding stem + 1 encoder block (768D, 12 heads)

Layers
13
Parameters
8.45M
Input
3 ร— 224 ร— 224
Output
196 ร— 1000
Verifier
Clean

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

Open ViT-B/16 on the canvas Free, no account needed

When to pick it

Pick for 224px+ images when pretrained weights are available, or when dataset is large enough (>1M images) to train from scratch.

Structure

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

LayerTypeParametersOutput shape
1imageInputshape=[3, 224, 224]3 ร— 224 ร— 224
2patch_embedPatch EmbedembedDim=768, patchSize=16196 ร— 768
3pos_embedPositional EncodingembedDim=768, maxLen=197196 ร— 768
4dropoutDropoutp=0196 ร— 768
5norm_1LayerNormnormalizedShape=768196 ร— 768
6attnMulti-Head AttentionembedDim=768, numHeads=12196 ร— 768
7residual_1Add196 ร— 768
8norm_2LayerNormnormalizedShape=768196 ร— 768
9mlpFeed ForwardffDim=3072196 ร— 768
10residual_2Add196 ร— 768
11norm_finalLayerNormnormalizedShape=768196 ร— 768
12headLinearoutFeatures=1000196 ร— 1000
13class_logitsOutput196 ร— 1000

What the verifier says

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

info"dropout" โ†’ "norm_1": BatchNorm re-normalizes the random zeros introduced by Dropout, nullifying most of its regularization effect. Fix: Reorder to Conv โ†’ BN โ†’ Activation โ†’ Dropout. (dropout)
dropout-before-bn

The PyTorch it exports

Generated from the graph above. First 46 lines; the app exports the whole file, plus the training loop, the data contract and a deploy bundle.

# 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 ViT_B16(nn.Module):
    def __init__(self):
        super().__init__()

        self.patchEmbed_1 = nn.Conv2d(3, 768, kernel_size=16, stride=16)  # Patch embedding (ViT-style)
        self.dropout_1 = nn.Dropout(p=0.5)
        self.layerNorm_1 = nn.LayerNorm(768)
        self.multiHeadAttention_1 = nn.MultiheadAttention(embed_dim=768, num_heads=12, batch_first=True)
        self.layerNorm_2 = nn.LayerNorm(768)
        self.feedForward_1 = nn.Sequential(
            nn.Linear(768, 3072),
            nn.ReLU(),
            nn.Linear(3072, 768)
        )
        self.layerNorm_3 = nn.LayerNorm(768)
        self.linear_1 = nn.Linear(768, 1000)

    def forward(self, x):
        # image shape: [3,224,224]
        patch_embed_mbed_1 = self.patchEmbed_1(x).flatten(2).transpose(1, 2)  # [B, num_patches, embed_dim]
        # positionalEncoding: add positional encoding externally (e.g. sinusoidal or learned PE)
        dropout_pout_1 = self.dropout_1(patch_embed_mbed_1)
        layer_norm_Norm_1 = self.layerNorm_1(dropout_pout_1)
        multi_head_attention_tion_1 = self.multiHeadAttention_1(layer_norm_Norm_1, layer_norm_Norm_1, layer_norm_Norm_1)[0]
        add_add_1 = multi_head_attention_tion_1 + dropout_pout_1
        layer_norm_Norm_2 = self.layerNorm_2(add_add_1)
        feed_forward_ward_1 = self.feedForward_1(layer_norm_Norm_2)
        add_add_2 = feed_forward_ward_1 + add_add_1
        layer_norm_Norm_3 = self.layerNorm_3(add_add_2)
        linear_near_1 = self.linear_1(layer_norm_Norm_3)
        # Output
        return linear_near_1


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

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

๐Ÿ–ผ๏ธ Simple CNN
Simple Convolutional Neural Network for image classification
9 layers ยท 804.6K
๐Ÿ”— 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
๐ŸชŸ Swin-Tiny
Hierarchical vision transformer โ€” shifted-window attention builds a feature pyramid for dense prediction
81 layers ยท 28.26M