enter image description here

Consider the first residual block. Its first convolution layer takes in inputs:

  1. THe PRELU's output

  2. 64 filters(64 outputs) each one being 3*3 with a stride of (1 ; 1)

So I think that the output of this convolution will have a different shape than the PRELU's output's one.

Then there is a second convolution layer in this same first residual block. So the shape will be even more different!

The first residual blocks ends with an elementwise sum... Which has these problematic inputs:

  1. PRELU's output

  2. The Conv2D, BN, PRELU, Conv2D, BN output

The problem is that, as explained above, the PRELU's output will have a shape quite different than "the Conv2D, BN, PRELU, Conv2D, BN output"'s shape.

So how is it theoretically possible (then technically, using Keras) to do this elementwise sum?

Edit: by "shape", I mean "width, height and eventually depth".


1 Answer 1


It's possible by adding 0 as padding to the tensor. What is currently refered to "same padding" (in particular in Keras).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.