From 17db031a058dc8ff2b5f791140e5698d3c368dbb Mon Sep 17 00:00:00 2001 From: Double_V Date: Tue, 3 Nov 2020 13:10:19 +0800 Subject: [PATCH] fix pool bug, test=develop (#28359) --- python/paddle/nn/functional/pooling.py | 6 +++--- python/paddle/nn/layer/pooling.py | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/python/paddle/nn/functional/pooling.py b/python/paddle/nn/functional/pooling.py index 73e3cb3122..40166f4d36 100755 --- a/python/paddle/nn/functional/pooling.py +++ b/python/paddle/nn/functional/pooling.py @@ -230,7 +230,7 @@ def avg_pool1d(x, x, 'pooling_type', 'avg', 'ksize', kernel_size, 'global_pooling', False, 'strides', stride, 'paddings', padding, 'padding_algorithm', padding_algorithm, 'use_cudnn', True, 'ceil_mode', ceil_mode, - 'use_mkldnn', False, 'exclusive', not exclusive, 'data_format', + 'use_mkldnn', False, 'exclusive', exclusive, 'data_format', data_format) return squeeze(output, [2]) @@ -338,7 +338,7 @@ def avg_pool2d(x, x, 'pooling_type', 'avg', 'ksize', kernel_size, 'global_pooling', False, 'padding_algorithm', padding_algorithm, 'strides', stride, 'paddings', padding, 'use_cudnn', True, 'ceil_mode', ceil_mode, - 'use_mkldnn', False, 'exclusive', not exclusive, 'data_format', + 'use_mkldnn', False, 'exclusive', exclusive, 'data_format', data_format) if divisor_override is None: return output @@ -452,7 +452,7 @@ def avg_pool3d(x, x, 'pooling_type', 'avg', 'ksize', kernel_size, 'strides', stride, 'paddings', padding, 'global_pooling', False, 'padding_algorithm', padding_algorithm, 'use_cudnn', True, 'ceil_mode', ceil_mode, - 'use_mkldnn', False, 'exclusive', not exclusive, 'data_format', + 'use_mkldnn', False, 'exclusive', exclusive, 'data_format', data_format) if divisor_override is None: return output diff --git a/python/paddle/nn/layer/pooling.py b/python/paddle/nn/layer/pooling.py index 0b0a4909f8..07cd0f61aa 100755 --- a/python/paddle/nn/layer/pooling.py +++ b/python/paddle/nn/layer/pooling.py @@ -503,6 +503,7 @@ class MaxPool2D(layers.Layer): stride=self.stride, padding=self.padding, return_mask=self.return_mask, + ceil_mode=self.ceil_mode, data_format=self.data_format, name=self.name) @@ -594,6 +595,7 @@ class MaxPool3D(layers.Layer): stride=self.stride, padding=self.padding, return_mask=self.return_mask, + ceil_mode=self.ceil_mode, data_format=self.data_format, name=self.name) -- GitLab