The result of Pytorch and Caffe is not same!

I have construct my model on pytorch. But the pooling layer is ‘floor’ of the value. In caffe, pooling layer is ‘ceil’ of the value. So I add padding in pooling layer.

However, the result of the caffe and pytorch is so different! The result of pytorch is lower than caffe about 4%. I don’t know why the difference is so large.

Did I miss something?

PyTorch pooling layers have an argument ceil_mode, which lets you chose between ceil or floor to compute the output shape.

1 Like

Thank you very much! I will try it.
And I have another question. I used BN layer in my structure. But when I pick up the feature of the Image, I see that it is not be normed. Did I should do something in testing?

For testing images, you should set your model to evaluation mode with: model.eval().

I have set that, but the result is a little strange.
I will first try the pooling ceil_mode and check whether there are some wrong. And if I also have some question, I wll consult with you.

Thank you!

Hello, have you solved the problem? I have similar problem too. Thank you!