Where is the implement of 'Padding' operation in CNTK source code ?
- Have I written custom code (as opposed to using example directory):
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10 & Linux Ubuntu 18.04
- CNTK version: 2.7
- Python version: 3.6.10
- CUDA/cuDNN version:
- GPU model and memory: -
I have encountered some difficulties when I investigating the implementation of MaxPool and AveragePool operation in CNTK the source code: I can see the functions of MaxPoolingForward and AveragePoolingForward near /CNTK-2.7/Source/Math/CPUMatrixImpl.h --- line4713. These two functions complete the pooling operation, but I find that the input of these two functions seems to have been padded, and I have not found the place to pad the input on the relevant execution path. I would like to inquire about how CNTK exactly pads the input data and the approximate position of the padding function in the source code.
Waiting for your reply.
I don't write c++ so i can't help you there. But there is something that you need to be aware of for pooling functions.
During calculations, paddings (i.e. the zeros on the edges) do not contribute to the pooling function. Imagine this:
0 - paddings 1 - image
0 0 0 0 1 1 1 0 1 1 1
For a 3x3 ave pooling, at the top-left corner of the image,
ave-pool = (1 + 1 + 1 + 1) / 4 = 1.
NOT (0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1) / 9 = 0.44444.....
Tensorflow, cntk, theano does the former. MxNet does the latter (without option to do the former).
I don't write c++ so i can't help you there. But there is something that you need to be aware of for pooling functions.
During calculations, paddings (i.e. the zeros on the edges) do not contribute to the pooling function. Imagine this:
Thank you for your reply! I just want to find out the Pad implement in source code to make sure something. I'm very curious where or what kind of operation CNTK uses to add these padding to the input