[enco/caffe] Average Pooling with Non Square Kernel (#2892)
author박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Tue, 22 Jan 2019 02:35:15 +0000 (11:35 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Tue, 22 Jan 2019 02:35:15 +0000 (11:35 +0900)
This commit fixes a bug in Caffe frontend which results in incorrect
results when there is an average pooling layer with non squre kernel.

This commit also adds a related regression test.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/enco/frontend/caffe/src/Layer/Pooling.cpp
contrib/enco/test/caffe/Regression_0000/INFERENCE [new file with mode: 0644]
contrib/enco/test/caffe/Regression_0000/test.prototxt [new file with mode: 0644]

index 7241cb0..36220d8 100644 (file)
@@ -107,8 +107,7 @@ void PoolingBuilder::build(const ::caffe::LayerParameter &layer, GraphBuilderCon
     op->divisor(coco::AvgPool2D::Divisor::Static);
 
     op->window()->height(spec.window_height());
-    // TODO FIX THIS BUG AND ADD TEST
-    op->window()->width(spec.window_height());
+    op->window()->width(spec.window_width());
 
     op->stride()->vertical(spec.vertical_stride());
     op->stride()->horizontal(spec.horizontal_stride());
diff --git a/contrib/enco/test/caffe/Regression_0000/INFERENCE b/contrib/enco/test/caffe/Regression_0000/INFERENCE
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/contrib/enco/test/caffe/Regression_0000/test.prototxt b/contrib/enco/test/caffe/Regression_0000/test.prototxt
new file mode 100644 (file)
index 0000000..5927d69
--- /dev/null
@@ -0,0 +1,17 @@
+layer {
+  name: "data"
+  type: "Input"
+  top: "data"
+  input_param { shape: { dim: 1 dim: 3 dim: 15 dim: 15 } }
+}
+layer {
+  name: "pool"
+  type: "Pooling"
+  bottom: "data"
+  top: "pool"
+  pooling_param {
+    pool: AVE
+    kernel_h: 3
+    kernel_w: 1
+  }
+}