From 0e6b303f54bacc252d3e4eed6f31a56ab7cdce91 Mon Sep 17 00:00:00 2001 From: Michal Gallus Date: Tue, 25 Sep 2018 14:40:41 +0200 Subject: [PATCH] MKLDNN Pooling: inline functions handling ceiled mode --- paddle/fluid/operators/pool_mkldnn_op.cc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/paddle/fluid/operators/pool_mkldnn_op.cc b/paddle/fluid/operators/pool_mkldnn_op.cc index b0132ceeb..56cef91e2 100644 --- a/paddle/fluid/operators/pool_mkldnn_op.cc +++ b/paddle/fluid/operators/pool_mkldnn_op.cc @@ -46,18 +46,17 @@ static std::string gethash(const memory::dims& input_dims, dims2str(paddings) + pooling_type + suffix; } -static int ComputeCeiledOutput(int input_size, int kernel_size, int padding, - int stride) { +static inline int ComputeCeiledOutput(int input_size, int kernel_size, + int padding, int stride) { return (input_size - kernel_size + 2 * padding) / stride + 1; } -static void CorrectOutputSize(const std::vector& src_tz, - const std::vector& dst_tz, - const std::vector& kernel_size, - const std::vector& paddings, - const std::vector& strides, - std::vector& right_bot_padding) { - for (int i = 0; i < right_bot_padding.size(); i++) { +static inline void CorrectOutputSize( + const std::vector& src_tz, const std::vector& dst_tz, + const std::vector& kernel_size, const std::vector& paddings, + const std::vector& strides, + std::vector& right_bot_padding) { // NOLINT + for (size_t i = 0; i < right_bot_padding.size(); i++) { int desired_size = ComputeCeiledOutput(src_tz[i + 2], kernel_size[i], paddings[i], strides[i]); if (desired_size != dst_tz[i + 2]) { -- GitLab