[exo-tflite] ShapeInference support for Custom Op (#6622)
author윤현식/On-Device Lab(SR)/Principal Engineer/삼성전자 <hyunsik.yoon@samsung.com>
Wed, 28 Aug 2019 07:32:51 +0000 (16:32 +0900)
committer박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Wed, 28 Aug 2019 07:32:51 +0000 (16:32 +0900)
* [exo-tflite] ShapeInference support for Custom Op

With this commit, ShapeInference can infer the shape of custom op.

Signed-off-by: Hyun Sik Yoon <hyunsik.yoon@samsung.com>
* adds an empty line; remove visit()

compiler/exo-tflite/src/ShapeInference.cpp

index 377dd0d..d71fed9 100644 (file)
 #include "ShapeInference.h"
 
 #include <loco/IR/CanonicalNode.h>
+#include <loco/IR/CanonicalDialect.h>
 #include <loco/IR/CanonicalNodeVisitor.h>
 #include <loco/Service/ShapeInference.h>
 #include <loco/Service/CanonicalShapeInferenceRule.h>
+#include <loco/Service/MultiDialectShapeInferenceRule.h>
+
+#include <locoex/COpCall.h>
+#include <locoex/COpDialect.h>
+#include <locoex/Service/COpShapeInferenceRule.h>
 
 void ShapeInference::run(loco::Graph *g)
 {
   // TODO Adjust indentation level
   {
-    loco::CanonicalShapeInferenceRule rule;
-    loco::apply(&rule).to(g);
+    loco::CanonicalShapeInferenceRule canonical_rule;
+    locoex::COpShapeInferenceRule cop_rule;
+    loco::MultiDialectShapeInferenceRule rules;
+
+    rules.bind(loco::CanonicalDialect::get(), &canonical_rule)
+        .bind(locoex::COpDialect::get(), &cop_rule);
+
+    loco::apply(&rules).to(g);
+
     return;
   }
 }