title: Do Keras Conv2d filters have a depth of three if the input has a depth of three?
body: <p>I've noticed that Conv2d layers are used in code where the input image has three dimensions. However, since we only enter two dimensions for the filter, how does the matrix multiplication take place?</p>
  
  <p>Does the two-dimensional filter convolve each input channel separately (or use broadcasting) (and then just add up the results)? </p>
  
  <p>Or does the depth of the filter automatically match the depth of the input (3 if color images)? If this is the case, 3x3x3 filter should have 27 weights that can be trained as opposed to 9 in the former case. </p>
  
  <p>Tensorflow is more explicit about the filter dimensions for conv2d (you have to input  <strong>height, width, channels, output_channel</strong>)</p>
  
  <p><a href="https://www.tensorflow.org/api_docs/python/tf/nn/conv2d" rel="nofollow noreferrer">https://www.tensorflow.org/api_docs/python/tf/nn/conv2d</a></p>