Concatenation

Combine · node type · Concat

Joins tensors side by side along one axis, keeping every input intact for the next layer to combine.

Also called Concat, Stack

Figure 1. Concatenation inside Label a photo with ImageNet, a real model in WeightSpace. The 8 outlined nodes are Concatenation; select any node for its shapes and parameters.

What it does

Concatenation places tensors next to each other along a chosen axis. Unlike addition it does not mix values: the next layer sees all inputs separately and learns how to combine them. U-Nets use it to bring fine detail from the encoder into the decoder, detectors use it to join features from several scales, and many graphs use it to assemble the final outputs or to join a class token to image patches.

Formula

Y = [X1 ; X2 ; …] along axis asizea(Y) = Σk sizea(Xk)

Shapes and parameters

Shapes
Inputs that match on every axis except the join axis; the output size on that axis is the sum.
Parameters
None.
Used for
U-Net skip connections, Inception and SqueezeNet fire modules, feature pyramids, joining heads of multi-head attention after a reshape.

Figure 2. The typed ports of Concatenation, 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.