From eb966ff5c7458eef3e4ad80de7e6c2e81e785d11 Mon Sep 17 00:00:00 2001 From: yangfei Date: Wed, 12 Sep 2018 11:34:31 +0800 Subject: [PATCH] repair bug of im2col --- src/operators/math/im2col.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/operators/math/im2col.cpp b/src/operators/math/im2col.cpp index 73e554a395..090ccdf24e 100644 --- a/src/operators/math/im2col.cpp +++ b/src/operators/math/im2col.cpp @@ -73,7 +73,9 @@ class Im2ColFunctor { const int osize = col_height; const int isize = im_height; bool pad1 = padding[0] > 0; - bool pad2 = padding[1] > 0; + bool pad2 = + (pad1 && padding[1] && + (((isize - 2 * padding[0] + filter_height) % stride[0] == 0) ? 1 : 0)); int fill = isize % 2; if (stride[0] == 1 && filter_height == 3 && pad1 && pad2 && dilation[0] == 1 && im_height > 2) { -- GitLab