Aleksander Monk
Aleksander Monk

Reputation: 2907

Caffe - Concat layer input and output

I read about Concat layer on Caffe website. However, I don't know if my understanding of it is right.

Let's say that as an input I have two layers that can be described as W1 x H1 x D1 and W2 x H2 x D2, where W is the width, H is height and D is depth.

Thus, as I understand with Axis set to 0 output will be (W1 + W2) x (H1 + H2) x D, where D = D1 = D2.

With Axis set to 1 output will be W x H x (D1 + D2), where H = H1 = H2 and W = W1 = W2.

Is my understanding correct? If no I would be grateful for an explanation.

Upvotes: 3

Views: 2074

Answers (1)

Shai
Shai

Reputation: 114786

I'm afraid you are a bit off...
Look at this caffe.help.

Usually, data in caffe is stored in 4D "blobs": BxCxHxW (that is, batch size by channel/feature/depth by height by width).
Now if you have two blobs B1xC1xH1xW1 and B2xC2xH2xW2 you can concatenate them along axis: 1 (along channel dimension) to form an output blob with C=C1+C2. This is only possible iff B1==B2 and H1==H2 and W1==W2, resulting with B1x(C1+C2)xH1xW1

Upvotes: 5

Related Questions