Skip to content

Commit

Permalink
- disabled non-linear adaptive pooling for oneDNN kernels
Browse files Browse the repository at this point in the history
test=develop
  • Loading branch information
jczaja committed Oct 6, 2020
1 parent abb6daf commit b7396f6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
15 changes: 11 additions & 4 deletions paddle/fluid/platform/mkldnn_reuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -927,10 +927,17 @@ class PoolingMKLDNNHandler : public MKLDNNHandlerT<T, mkldnn::pooling_forward,
const std::vector<int64_t>& src_tz, std::vector<int64_t>& ksize,
std::vector<int64_t>& strides) {
if (ctx.Attr<bool>("adaptive")) {
ksize[0] = static_cast<int>(
ceil(static_cast<double>(src_tz[src_tz.size() - 2] / ksize[0])));
ksize[1] = static_cast<int>(
ceil(static_cast<double>(src_tz[src_tz.size() - 1] / ksize[1])));
// (jczaja): oneDNN is supporting only unchangable in size pool window
PADDLE_ENFORCE_EQ(
src_tz[src_tz.size() - 1] % ksize[1], 0,
platform::errors::Unimplemented(
"Input dim must be divisible by corressponding ksize dim."));
PADDLE_ENFORCE_EQ(
src_tz[src_tz.size() - 2] % ksize[0], 0,
platform::errors::Unimplemented(
"Input dim must be divisible by corressponding ksize dim."));
ksize[0] = src_tz[src_tz.size() - 2] / ksize[0];
ksize[1] = src_tz[src_tz.size() - 1] / ksize[1];
strides[0] = ksize[0];
strides[1] = ksize[1];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,18 @@ def init_test_case(self):
def init_data_type(self):
self.dtype = np.float32

def init_global_pool(self):
self.global_pool = False


class TestAvgPoolAdaptive2(TestAvgPoolAdaptive):
def init_test_case(self):
self.ksize = [2, 2]
self.ksize = [2, 3]
self.strides = [1, 1]

def init_shape(self):
self.shape = [2, 3, 6, 6]


class TestAsymPad(TestPool2D_Op):
def init_test_case(self):
Expand Down

0 comments on commit b7396f6

Please sign in to comment.