Closed andreadps closed 3 years ago
I has found this problem.How did you solve this problem?
I found that all of softpool2d without force_inplace will not change the size of tensor
Hi @andreadps,
Thanks for this. The stride calculations should now be updated with the latest commit 70e7b3b.
Best, Alex
First of all, great work with SoftPool!
When I was adapting some code to test SoftPool for the first time, I left a
stride=1
on the SoftPool2d constructor and noticed this inconsistent behavior on CPU (PyTorch implementation) vs GPU (CUDA implementation).The shape of the output is different on the two implementations. With kernel 2 and stride 1 over a 3x3 input, I expected a 2x2 output, but the CUDA implementation gives 3x3. The example below illustrates well the difference.
It looks to me that this is a bug on the way the CUDA path handles the output shape. On
CUDA_SOFTPOOL2d
, it does something likeoH = H // stride[0]
while it should do something likeoH = (H - kernel_height) // stride[0] + 1
. Of course some other parts of the code would need to be adapted as well.