Is the size of the output of a pooling layer miscalculated? Instead of:
pooled_height_ = static_cast<int>(ceil(static_cast<float>(
height_ + 2 * pad_h_ - kernel_h_) / stride_h_)) + 1;
it should have been:
pooled_height_ = static_cast<int>(ceil(static_cast<float>(
height_ + 2 * pad_h_ - kernel_h_ + 1) / stride_h_));
And similarly for the width.
E.g., ceil((4+2_0-3)/2)+1 != ceil((4+2_0-3+1)/2) .