← All models

MODEL EXPLORER / VISION MILESTONES

Follow shortcuts through eighteen layers

What can flow through a shortcut when a residual branch changes?

Curated by TensorVizResNet-18 · 4-step tour
Static architecture
What can flow through a shortcut when a residual branch changes?
Opening the interactive graph…
Architecture snapshot · No Python requiredDownload graph ↓

RECORDED NUMERICAL EXAMPLE

A shortcut around two convolutions.

Recorded intervention on an untrained identity-shortcut basic block. The full graph preserves ResNet-18's stage pattern, while this comparison isolates a single residual addition.

The first basic-block form is tested on fixed synthetic features while its final convolution weights are scaled. The shortcut remains fixed. Original ResNet basic blocks apply ReLU after addition, so a zero branch returns ReLU(x), not every signed input unchanged. This demonstrates arithmetic and a gradient path, not an empirical training-stability result.

Shortcut · channel 0

Min -1.4 · Max 0.6

Recorded cell values
Row / col01234567
0-1.4-1.368-1.337-1.305-1.273-1.241-1.21-1.178
1-1.146-1.114-1.083-1.051-1.019-0.9873-0.9556-0.9238
2-0.8921-0.8603-0.8286-0.7968-0.7651-0.7333-0.7016-0.6698
3-0.6381-0.6063-0.5746-0.5429-0.5111-0.4794-0.4476-0.4159
4-0.3841-0.3524-0.3206-0.2889-0.2571-0.2254-0.1937-0.1619
5-0.1302-0.09841-0.06667-0.03492-0.0031750.028570.060320.09206
60.12380.15560.18730.2190.25080.28250.31430.346
70.37780.40950.44130.4730.50480.53650.56830.6
Residual branch · channel 0

Min 0 · Max 0

Recorded cell values
Row / col01234567
000000000
100000000
200000000
300000000
400000000
500000000
600000000
700000000
After addition + ReLU · channel 0

Min 0 · Max 0.6

Recorded cell values
Row / col01234567
000000000
100000000
200000000
300000000
400000000
5000000.028570.060320.09206
60.12380.15560.18730.2190.25080.28250.31430.346
70.37780.40950.44130.4730.50480.53650.56830.6

Each heatmap uses its own scale. Mint is positive, rust is negative, and the lightest color is zero. Table values are rounded to four significant digits.

Before addition · eight channels at pixel (4,4)
-0.2571
-0.1429
-0.02857
0.08571
0.2
0.3143
0.4286
0.5429
After addition · before ReLU
-0.2571
-0.1429
-0.02857
0.08571
0.2
0.3143
0.4286
0.5429
After ReLU
0
0
0
0.08571
0.2
0.3143
0.4286
0.5429

Bars share one scale within this example. Values are rounded to four significant digits.

Residual branch scale
0
Elements clipped by output ReLU
256
Verified by the local recipe
  • A zero residual branch leaves ReLU(x), including the original post-addition activation
  • The shortcut carries unit gradients on positive inputs when the residual branch is zero
  • Stride-two projection shortcuts match the residual branch channel and spatial dimensions
  • Four [2,2,2,2] stages produce 16/8/4/2-pixel maps before global averaging

Download the source and run.py to reproduce these checks. Choosing an example here replays recorded values.

ABOUT THIS EXAMPLE

Explore the full ResNet-18 block pattern at reduced width, with identity and projection shortcuts, batch normalization and post-addition ReLU.

Architecture · 2015

ResNet-18

Original [2,2,2,2] basic-block stage pattern, 7×7 stride-2 stem and max pool, widths reduced to 8/16/32/64. Uses batch normalization, stride-2 projection shortcuts and ReLU after addition.

Source, capture & limitations +

Untrained 64×64 reference with reduced widths and ten output classes. Unlike the earlier generic residual example, this follows the ResNet-18 basic-block pattern. Numerical shortcut checks do not establish training performance or accuracy; BatchNorm runs with initial evaluation statistics.

Original TensorViz teaching example. PyTorch provides the underlying operators.

No separate redistribution license has been declared for these project examples.

Content revision
22389a64ed4ca366
Source SHA-256
7d174000085621c697f0c024c9f4c596f637ffdbcab9ed091cdf6b4e4a173005
Captured
2026-09-17 · Python 3.13.13 / Torch 2.7.1

Reduced-width ResNet-18 CPU forward, zero-branch and shortcut gradient checks, projected-shape agreement and stage-shape/global-average verification.

Read the model manifest ↗