I have a question about the conv neural net. Specially from the deeplearning tutorial at http://deeplearning.net/tutorial/lenet.html.

In Fig 1 from that url, (and also similarly in between C3 and S4, in Fig 2 of the Gradient Based Learning paper by Lecun Yann), I cannot understand how all the feature maps from layer m-1 gets into a single pixel on layer m, using a single filter/kernel.

For this to happen the kernel needs to be 3D. But I cannot understand how exactly a 3D kernel convolution works on 3 different images. Is it a average of the 3 values after applying 3 2D convolutions ? The documentation says "and pool over several input channels" . What is the significance of pool here ?

Also the kernel (or weights) as created in the code below (under "We use two convolutional filters with 9x9 receptive fields. ...."), has all values different. I would have assumed that at least per filter/kernel the values will be replicated on the 3 planes. So that the same feature is extracted from all the 3 maps. If the values are all different, then conceptually, the "one value" that comes out of the convolution does not seem to have a "purpose" as it is getting all mixed messages.


1 Answer 1


I've stumbled upon this before, and it is is generally poorly explained. It's best to think of images as three dimensional, with a width, a height and a number of channels $w \times h \times c$. An input image for instance might have three channels, one for each color.

The next layer might have 50 different filters, so you can think of it again as a three dimensional structure, with 50 channels.

Now how do we get from one to the other with convolutional filters? Well, as you've intuited, the filters are actually three dimensional, but they only convolve in the two dimensional pixel plane (one way to think about it is that they're as tall as the number of channels, so they can't move in that direction).

Pooling is a different operation, it's a group non linearity that is meant to reduce the size of the layer. Max pooling has the property that it gives you some amount of translation invariance.

  • $\begingroup$ Thanks Arthur. Ok if they "convolve in the two dimensional pixel plane" - then how do they arrive at 1 value. Each two dimensional pixel plane when convolved with a two dimensional filter will give one value. So you have 3 values for one (identical across channels) location. So - how do you get down to one value ? $\endgroup$
    – Run2
    Nov 13, 2014 at 16:42
  • 1
    $\begingroup$ Think of a thick hockey puck that you move between two planks. That's your filter. It only convolves in 2 dimensions, but it is 3 dimensional. $\endgroup$
    – Arthur B.
    Nov 13, 2014 at 16:47
  • $\begingroup$ Aha! ok - now I got the answer (from two other places I posted this comment on) - they "sum" it. " The output of ConvOp is a 4D tensor, generated as follows: code output[b,k,:,:] = \sum_i input[b,i,:,:] * filter[k,i,:,:] \forall b,k code where b is the mini-batch index, k the filter index and * is the convolution operator. ". I got this from Naveen in the following forum plus.google.com/communities/112866381580457264725. So "sum" is the answer. But your answer is pretty much there too. Hence marking as correct answer. THanks $\endgroup$
    – Run2
    Nov 13, 2014 at 16:58
  • $\begingroup$ - It's not just a simple sum, it's a linear combination - It's only a 4D tensor if you consider batches size $\endgroup$
    – Arthur B.
    Nov 13, 2014 at 16:59
  • $\begingroup$ Ok - so you mean there are weights involved in that linear combination ? $\endgroup$
    – Run2
    Nov 13, 2014 at 17:00

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.