[mir_onnx] Switch to AvgPool2D and MaxPool2D ops (#7023)
authorСергей Баранников/AI Tools Lab /SRR/Engineer/삼성전자 <s.barannikov@samsung.com>
Thu, 29 Aug 2019 21:34:27 +0000 (06:34 +0900)
committerAlexander Efimov/AI Tools Lab/./Samsung Electronics <a.efimov@samsung.com>
Thu, 29 Aug 2019 21:34:27 +0000 (00:34 +0300)
Switch from `PoolOp` to `AvgPool2DOp` and `MaxPool2DOp`. The former ones are deprecated.

Signed-off-by: Sergei Barannikov <s.barannikov@samsung.com>
compiler/mir-onnx-importer/Op/AveragePool.cpp
compiler/mir-onnx-importer/Op/MaxPool.cpp

index 962961e..bd4c10a 100644 (file)
@@ -20,7 +20,7 @@
 #include "AttributeHelpers.h"
 #include "ConvPoolHelpers.h"
 
-#include "mir/ops/PoolOp.h"
+#include "mir/ops/AvgPool2DOp.h"
 
 namespace mir_onnx
 {
@@ -82,11 +82,9 @@ void AveragePoolNodeConverter::convertV1(const onnx::NodeProto &onnx_node,
   }
 
   input = convertONNXToMIR(graph, input);
-  auto result =
-      createOp<mir::ops::PoolOp>(graph, input, mir::ops::PoolOp::PoolingType::AVG,
-                                 mir::Shape(kernel_shape), mir::Shape(strides), padding_before,
-                                 padding_after, mir::ops::PoolOp::BorderType::EMPTY)
-          ->getOutput(0);
+  auto result = createOp<mir::ops::AvgPool2DOp>(graph, input, kernel_shape, strides, padding_before,
+                                                padding_after, false, mir::DataFormat::NHWC)
+                    ->getOutput(0);
   result = convertMIRToONNX(graph, result);
 
   context->setNodeOutputs(onnx_node, {result});
index 7633018..0ba4524 100644 (file)
@@ -20,7 +20,7 @@
 #include "AttributeHelpers.h"
 #include "ConvPoolHelpers.h"
 
-#include "mir/ops/PoolOp.h"
+#include "mir/ops/MaxPool2DOp.h"
 
 namespace mir_onnx
 {
@@ -82,11 +82,9 @@ void MaxPoolNodeConverter::convertV1(const onnx::NodeProto &onnx_node,
   }
 
   input = convertONNXToMIR(graph, input);
-  auto result =
-      createOp<mir::ops::PoolOp>(graph, input, mir::ops::PoolOp::PoolingType::MAX,
-                                 mir::Shape(kernel_shape), mir::Shape(strides), padding_before,
-                                 padding_after, mir::ops::PoolOp::BorderType::EMPTY)
-          ->getOutput(0);
+  auto result = createOp<mir::ops::MaxPool2DOp>(graph, input, kernel_shape, strides, padding_before,
+                                                padding_after, mir::DataFormat::NHWC)
+                    ->getOutput(0);
   result = convertMIRToONNX(graph, result);
 
   context->setNodeOutputs(onnx_node, {result});