Residual connection

Combine · node type · Add, Sum

Adds a block’s input back to its output, so the block only has to learn a correction.

Also called Skip connection, Add, Shortcut

Figure 1. Residual connection inside Brighten a low-light photo, a real model in WeightSpace. The outlined node is Residual connection; select any node for its shapes and parameters.

What it does

A residual connection carries the input of a block around it and adds it to the block’s output. If the block learns nothing useful, the sum still equals the input, so stacking more blocks cannot easily make the network worse. Gradients also flow straight through the addition, which made networks with dozens or hundreds of layers trainable. Both tensors must have the same shape; when a block changes the channel count or resolution, the shortcut gets its own 1 × 1 convolution or pooling. In ONNX it is a plain Add whose two inputs come from different depths.

Formula

y = x + F(x)

Shapes and parameters

Shapes
Two tensors of the same shape (or broadcastable) in, the same shape out.
Parameters
None for the addition. A projection shortcut, when present, is a 1 × 1 convolution counted separately.
Used for
ResNet and MobileNet V2 blocks, every transformer layer (around attention and around the feed-forward block), U-Net variants, DnCNN’s global residual.

Figure 2. The typed ports of Residual connection, in the same format as every model drawing. Letters such as N or C stand for any size.

In WeightSpace

Read-only in WeightSpace today. In the low-light enhancer the illumination estimate is added back to the input image in the same way, after the edited output logits.

Where it appears