CNN interview question

Deep LearningCNNbasic

What does a 2-D convolutional layer compute at each output position?

  1. AThe largest value inside the input patch under the window, keeping only the strongest local response.
  2. BThe plain average of the input patch under the window, using fixed equal weights that are never learned.
  3. CThe dot product of a small learned kernel with the input patch beneath it, summed over channels, plus a bias.
  4. DA weighted sum of every input pixel, each with its own separate weight, exactly as in a fully connected layer.
Show the answer and explanation

Correct answer: C, The dot product of a small learned kernel with the input patch beneath it, summed over channels, plus a bias.

Explanation CNN

A convolutional layer slides a small learned kernel (say 3×3×C_in) over the input. At each position it multiplies the kernel element-wise with the patch underneath, sums over the kernel's height, width and all input channels, and adds a bias. The result is one value of the output feature map; repeating this at every position builds the whole map.

Why the other descriptions are wrong:

  • Taking the largest value in the window is max pooling, which has no learned weights.
  • A fixed, equal-weight average is average pooling, again with nothing learned.
  • One separate weight per input pixel is a fully connected layer; a conv layer reuses the same small kernel everywhere and only looks at a local patch.

Strictly speaking, deep-learning libraries implement cross-correlation (the kernel is not flipped), but since the kernel is learned this makes no practical difference and everyone calls it convolution.

Interview tip: describe it as "slide, multiply, sum, add bias" and mention that one kernel produces one output channel.

Practice it as a quiz

Answer this and the other free questions with instant grading, streaks and weak-topic tracking, or unlock all 4,000 questions.

More Deep Learning questions

  1. In a vanilla recurrent neural network, what is the hidden state?
  2. What is the core idea of an attention mechanism in a neural network?
  3. Which statement best defines transfer learning?
  4. Two system outputs are scored against a single reference in the table. Which interpretation of the scores is correct?
  5. A telecom's search-box autocomplete uses a bigram language model with add-one (Laplace) smoothing, P(w prev) = (c(prev, w) + 1) / (c(prev) + V). The table…