1

When using TF's Conv2D layer with padding='SAME', i.e., expecting the output to be in the same 2D shape as the input, does it first pad the input with zeros and then proceeds to the convolution, or does it first compute the convolution on the input as is, and then applies the zero padding on the result?

SomethingSomething
  • 11,491
  • 17
  • 68
  • 126
  • I think this is a duplicate: https://stats.stackexchange.com/questions/274601/convolutional-neural-networks-what-is-done-first-padding-or-convolving – Courage Feb 23 '20 at 11:43
  • @Oswald thank you. This is a very similar question, but it is theoretical and not related to TensorFlow. It makes sense that the padding is applied before the convolution, but I'm not sure that this is the case in TF, since (2DZeroPadding+Conv2DwithValidPadding) returned a different output from Conv2DwithSamePadding. The first option returned output that was identical to a PyTorch network. – SomethingSomething Feb 23 '20 at 14:33

0 Answers0