[moco-tf] Update to use moco TFDialect (#8514)
author박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Mon, 28 Oct 2019 06:36:07 +0000 (15:36 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Mon, 28 Oct 2019 06:36:07 +0000 (15:36 +0900)
This will update to use TFDialect from moco project

Signed-off-by: SaeHie Park <saehie.park@samsung.com>
52 files changed:
compiler/moco-tf/src/Canonicalization/AddCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/AddCanonicalizer.h
compiler/moco-tf/src/Canonicalization/AvgPoolCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/AvgPoolCanonicalizer.h
compiler/moco-tf/src/Canonicalization/BiasAddCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/BiasAddCanonicalizer.h
compiler/moco-tf/src/Canonicalization/ConcatV2Canonicalizer.cpp
compiler/moco-tf/src/Canonicalization/ConcatV2Canonicalizer.h
compiler/moco-tf/src/Canonicalization/ConstCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/ConstCanonicalizer.h
compiler/moco-tf/src/Canonicalization/Conv2DBackpropInputCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/Conv2DBackpropInputCanonicalizer.h
compiler/moco-tf/src/Canonicalization/Conv2DCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/Conv2DCanonicalizer.h
compiler/moco-tf/src/Canonicalization/DepthwiseConv2dNativeCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/DepthwiseConv2dNativeCanonicalizer.h
compiler/moco-tf/src/Canonicalization/IdentityCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/IdentityCanonicalizer.h
compiler/moco-tf/src/Canonicalization/MaxPoolCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/MaxPoolCanonicalizer.h
compiler/moco-tf/src/Canonicalization/MeanCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/MeanCanonicalizer.h
compiler/moco-tf/src/Canonicalization/MulCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/MulCanonicalizer.h
compiler/moco-tf/src/Canonicalization/PadCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/PadCanonicalizer.h
compiler/moco-tf/src/Canonicalization/PlaceholderCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/RealDivCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/RealDivCanonicalizer.h
compiler/moco-tf/src/Canonicalization/Relu6Canonicalizer.cpp
compiler/moco-tf/src/Canonicalization/Relu6Canonicalizer.h
compiler/moco-tf/src/Canonicalization/ReluCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/ReluCanonicalizer.h
compiler/moco-tf/src/Canonicalization/ReshapeCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/ReshapeCanonicalizer.h
compiler/moco-tf/src/Canonicalization/RsqrtCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/RsqrtCanonicalizer.h
compiler/moco-tf/src/Canonicalization/SoftmaxCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/SoftmaxCanonicalizer.h
compiler/moco-tf/src/Canonicalization/SqrtCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/SqrtCanonicalizer.h
compiler/moco-tf/src/Canonicalization/SqueezeCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/SqueezeCanonicalizer.h
compiler/moco-tf/src/Canonicalization/StopGradientCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/StopGradientCanonicalizer.h
compiler/moco-tf/src/Canonicalization/SubCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/SubCanonicalizer.h
compiler/moco-tf/src/Canonicalization/TanhCanonicalizer.cpp
compiler/moco-tf/src/Canonicalization/TanhCanonicalizer.h
compiler/moco-tf/src/Canonicalizer.cpp
compiler/moco-tf/src/Transforms/ShapeInferencePass.cpp
compiler/moco-tf/src/Transforms/TypeInferencePass.cpp

index 23631b7..8028a87 100644 (file)
@@ -16,8 +16,8 @@
 
 #include "AddCanonicalizer.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
+#include <moco/IR/TFDialect.h>
+#include <moco/IR/TFNodes.h>
 
 #include "TFEltwiseBinaryCanonicalzeHelper.h"
 
index 3b3f11b..53ba9ed 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
index 749f386..924121c 100644 (file)
 #include "AvgPoolCanonicalizer.h"
 #include "TFShapeInferenceHelper.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
-#include "Dialect/TFNodeVisitor.h"
-#include "Dialect/TFNodeImpl.h"
+#include <moco/IR/TFDialect.h>
 
 #include "CodecHelper.h"
 
@@ -31,7 +28,7 @@
 namespace
 {
 
-bool canonicalize_avgpool2d(loco::Graph *graph, moco::tf::TFAvgPool *node)
+bool canonicalize_avgpool2d(loco::Graph *graph, moco::TFAvgPool *node)
 {
   LOGGER(l);
 
index 805c915..e9c56c8 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
@@ -31,7 +32,7 @@ namespace tf
 /**
  * @brief  Convert TFAvgPool to Canonical AvgPool2D
  */
-class AvgPoolCanonicalizer : public SimpleNodeTransform<TFAvgPool>
+class AvgPoolCanonicalizer : public SimpleNodeTransform<moco::TFAvgPool>
 {
 public:
   const char *name(void) const final { return "AvgPoolCanonicalizer"; }
index c05292e..dd2884c 100644 (file)
 
 #include "BiasAddCanonicalizer.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
-#include "Dialect/TFNodeVisitor.h"
-#include "Dialect/TFNodeImpl.h"
+#include <moco/IR/TFDialect.h>
 
 #include <moco/tf/Names.h>
 #include <moco/Log.h>
@@ -29,7 +26,7 @@ namespace
 {
 using plier::tf::DataLayout;
 
-bool canonicalize_biasadd(loco::Graph *graph, moco::tf::TFBiasAdd *node)
+bool canonicalize_biasadd(loco::Graph *graph, moco::TFBiasAdd *node)
 {
   LOGGER(l);
 
index 01e6d2a..ff4032c 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
@@ -31,7 +32,7 @@ namespace tf
 /**
  * @brief  Convert TFBiasAdd to Canonical BiasAdd
  */
-class BiasAddCanonicalizer final : public SimpleNodeTransform<TFBiasAdd>
+class BiasAddCanonicalizer final : public SimpleNodeTransform<moco::TFBiasAdd>
 {
 public:
   const char *name(void) const final { return "BiasAddCanonicalizer"; }
index 14493f1..8b2877a 100644 (file)
 #include "TFShapeInferenceHelper.h"
 #include "LogHelper.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
-#include "Dialect/TFNodeVisitor.h"
-#include "Dialect/TFNodeImpl.h"
+#include <moco/IR/TFDialect.h>
 
 #include <moco/Log.h>
 
@@ -34,7 +31,7 @@ namespace
 
 using namespace moco::tf;
 
-int32_t scala_value(moco::tf::TFConst *node)
+int32_t scala_value(moco::TFConst *node)
 {
   auto nodeshape = node_shape(node);
   assert(node->dtype() == loco::DataType::S32);
@@ -45,7 +42,7 @@ int32_t scala_value(moco::tf::TFConst *node)
   return node->at<loco::DataType::S32>(0);
 }
 
-bool canonicalize_concat(loco::Graph *graph, moco::tf::TFConcatV2 *node)
+bool canonicalize_concat(loco::Graph *graph, moco::TFConcatV2 *node)
 {
   LOGGER(l);
 
@@ -99,7 +96,7 @@ bool canonicalize_concat(loco::Graph *graph, moco::tf::TFConcatV2 *node)
   {
     // axis should be TFConst
     auto axis_node = node->axis();
-    auto tfconst = dynamic_cast<moco::tf::TFConst *>(axis_node);
+    auto tfconst = dynamic_cast<moco::TFConst *>(axis_node);
     assert(tfconst != nullptr);
     axis_value = scala_value(tfconst);
   }
index a9d3f68..e6b471b 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
@@ -31,13 +32,13 @@ namespace tf
 /**
  * @brief  Convert TFConcatV2 to Canonical TensorConcat
  */
-class ConcatV2Canonicalizer : public SimpleNodeTransform<TFConcatV2>
+class ConcatV2Canonicalizer : public SimpleNodeTransform<moco::TFConcatV2>
 {
 public:
   const char *name(void) const final { return "ConcatV2Canonicalizer"; }
 
 public:
-  bool transform(TFConcatV2 *node) const final;
+  bool transform(moco::TFConcatV2 *node) const final;
 };
 
 } // namespace tf
index 5dc5158..403024d 100644 (file)
 
 #include "ConstCanonicalizer.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
-#include "Dialect/TFNodeVisitor.h"
-#include "Dialect/TFNodeImpl.h"
+#include <moco/IR/TFDialect.h>
 
 #include <moco/tf/Names.h>
 #include <moco/Log.h>
@@ -27,7 +24,7 @@
 namespace
 {
 
-bool canonicalize_const(loco::Graph *graph, moco::tf::TFConst *node)
+bool canonicalize_const(loco::Graph *graph, moco::TFConst *node)
 {
   LOGGER(l);
 
index 31f870e..1b0b2b8 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
@@ -31,13 +32,13 @@ namespace tf
 /**
  * @brief  Convert TFConst to Canonical ConstGen
  */
-class ConstCanonicalizer : public SimpleNodeTransform<TFConst>
+class ConstCanonicalizer : public SimpleNodeTransform<moco::TFConst>
 {
 public:
   const char *name(void) const final { return "ConstCanonicalizer"; }
 
 public:
-  bool transform(TFConst *) const final;
+  bool transform(moco::TFConst *) const final;
 };
 
 } // namespace tf
index 3268c54..057caf5 100644 (file)
@@ -16,8 +16,7 @@
 
 #include "Conv2DBackpropInputCanonicalizer.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
+#include <moco/IR/TFDialect.h>
 
 #include "CodecHelper.h"
 
@@ -86,7 +85,7 @@ public:
   PlaneShape &output() { return _output; }
   loco::Stride<2> &stride() { return _stride; }
   loco::Window<2> &window() { return _window; }
-  moco::tf::TFPadding &padding() { return _padding; }
+  moco::TFPadding &padding() { return _padding; }
 
 private:
   /// @brief  Check whether ingredients set by non-default values
@@ -145,7 +144,7 @@ private:
   PlaneShape _output;
   loco::Stride<2> _stride;
   loco::Window<2> _window;
-  moco::tf::TFPadding _padding;
+  moco::TFPadding _padding;
 };
 
 loco::Padding2D Padding2DInference::operator()(void)
@@ -262,7 +261,7 @@ namespace
 {
 
 bool canonicalize_conv2d_backprop_input(loco::Graph *graph,
-                                        moco::tf::TFConv2DBackpropInput *conv2d_backprop)
+                                        moco::TFConv2DBackpropInput *conv2d_backprop)
 {
   /**
    * @note This will replace TFConv2DBackpropInput node with canonical
index a5650c4..bc37bb9 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
@@ -29,13 +30,13 @@ namespace tf
 {
 
 /// @brief  Convert TFConv2DBackpropInput to Canonical TransposedConv2D
-class Conv2DBackpropInputCanonicalizer : public SimpleNodeTransform<TFConv2DBackpropInput>
+class Conv2DBackpropInputCanonicalizer : public SimpleNodeTransform<moco::TFConv2DBackpropInput>
 {
 public:
   const char *name(void) const final { return "Conv2DBackpropInputCanonicalizer"; }
 
 public:
-  bool transform(TFConv2DBackpropInput *) const final;
+  bool transform(moco::TFConv2DBackpropInput *) const final;
 };
 
 } // namespace tf
index 51188ed..ea8dde4 100644 (file)
 #include "Conv2DCanonicalizer.h"
 #include "TFShapeInferenceHelper.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
-#include "Dialect/TFNodeVisitor.h"
-#include "Dialect/TFNodeImpl.h"
+#include <moco/IR/TFDialect.h>
 
 #include "CodecHelper.h"
 
@@ -44,7 +41,7 @@ void set_filter_enc(loco::FilterEncode *filter_enc)
   filter_enc->encoder(std::move(enc));
 }
 
-bool canonicalize_conv2d(loco::Graph *graph, moco::tf::TFConv2D *node)
+bool canonicalize_conv2d(loco::Graph *graph, moco::TFConv2D *node)
 {
   LOGGER(l);
 
index 191e49f..ea39667 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
index 059b71b..abf77ce 100644 (file)
 #include "DepthwiseConv2dNativeCanonicalizer.h"
 #include "TFShapeInferenceHelper.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
-#include "Dialect/TFNodeVisitor.h"
-#include "Dialect/TFNodeImpl.h"
+#include <moco/IR/TFDialect.h>
 
 #include "CodecHelper.h"
 
@@ -45,7 +42,7 @@ void set_filter_enc(loco::DepthwiseFilterEncode *filter_enc)
   filter_enc->encoder(std::move(enc));
 }
 
-bool canonicalize_depthwiseconv2dnative(loco::Graph *graph, moco::tf::TFDepthwiseConv2dNative *node)
+bool canonicalize_depthwiseconv2dnative(loco::Graph *graph, moco::TFDepthwiseConv2dNative *node)
 {
   LOGGER(l);
 
index bdf8abf..704e1ad 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 namespace moco
 {
@@ -29,13 +30,13 @@ namespace tf
 /**
  * @brief  Convert TFDepthwiseConv2dNative to Canonical DepthwiseConv2D
  */
-class DepthwiseConv2dNativeCanonicalizer : public SimpleNodeTransform<TFDepthwiseConv2dNative>
+class DepthwiseConv2dNativeCanonicalizer : public SimpleNodeTransform<moco::TFDepthwiseConv2dNative>
 {
 public:
   const char *name(void) const final { return "DepthwiseConv2dNativeCanonicalizer"; }
 
 public:
-  bool transform(TFDepthwiseConv2dNative *) const final;
+  bool transform(moco::TFDepthwiseConv2dNative *) const final;
 };
 
 } // namespace tf
index 0b5329f..d5d75fa 100644 (file)
 
 #include "Convert.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
-#include "Dialect/TFNodeVisitor.h"
-#include "Dialect/TFNodeImpl.h"
+#include <moco/IR/TFDialect.h>
 
 #include <moco/tf/Names.h>
 #include <moco/Log.h>
@@ -29,7 +26,7 @@
 namespace
 {
 
-bool canonicalize_identity(loco::Graph *graph, moco::tf::TFIdentity *node)
+bool canonicalize_identity(loco::Graph *graph, moco::TFIdentity *node)
 {
   LOGGER(l);
 
index 79d3270..59b2894 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
@@ -31,13 +32,13 @@ namespace tf
 /**
  * @brief  Convert TFIdentity to Canonical Forward
  */
-class IdentityCanonicalizer : public SimpleNodeTransform<TFIdentity>
+class IdentityCanonicalizer : public SimpleNodeTransform<moco::TFIdentity>
 {
 public:
   const char *name(void) const final { return "IdentityCanonicalizer"; }
 
 public:
-  bool transform(TFIdentity *) const final;
+  bool transform(moco::TFIdentity *) const final;
 };
 
 } // namespace tf
index 9acd85e..0d8d8b4 100644 (file)
 #include "MaxPoolCanonicalizer.h"
 #include "TFShapeInferenceHelper.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
-#include "Dialect/TFNodeVisitor.h"
-#include "Dialect/TFNodeImpl.h"
+#include <moco/IR/TFDialect.h>
 
 #include "CodecHelper.h"
 
@@ -29,7 +26,7 @@
 namespace
 {
 
-bool canonicalize_maxpool2d(loco::Graph *graph, moco::tf::TFMaxPool *node)
+bool canonicalize_maxpool2d(loco::Graph *graph, moco::TFMaxPool *node)
 {
   LOGGER(l);
 
index b0caf0b..c58ade5 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
@@ -31,13 +32,13 @@ namespace tf
 /**
  * @brief  Convert TFMaxPool to Canonical MaxPool2D
  */
-class MaxPoolCanonicalizer : public SimpleNodeTransform<TFMaxPool>
+class MaxPoolCanonicalizer : public SimpleNodeTransform<moco::TFMaxPool>
 {
 public:
   const char *name(void) const final { return "MaxPoolCanonicalizer"; }
 
 public:
-  bool transform(TFMaxPool *) const final;
+  bool transform(moco::TFMaxPool *) const final;
 };
 
 } // namespace tf
index d3123f7..69eaf79 100644 (file)
@@ -22,7 +22,10 @@ namespace moco
 namespace tf
 {
 
-bool MeanCanonicalizer::transform(TFMean *node) const { return canonicalize_reduce_node(node); }
+bool MeanCanonicalizer::transform(moco::TFMean *node) const
+{
+  return canonicalize_reduce_node(node);
+}
 
 } // namespace tf
 } // namespace moco
index 1fe293c..469d7e3 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
@@ -31,13 +32,13 @@ namespace tf
 /**
  * @brief Canonicalize TF-dialect TFMean into canonical TensorReduce(Mean) node
  */
-class MeanCanonicalizer : public SimpleNodeTransform<TFMean>
+class MeanCanonicalizer : public SimpleNodeTransform<moco::TFMean>
 {
 public:
   const char *name(void) const final { return "MeanCanonicalizer"; }
 
 public:
-  bool transform(TFMean *) const final;
+  bool transform(moco::TFMean *) const final;
 };
 
 } // namespace tf
index fec4796..d02f713 100644 (file)
@@ -16,8 +16,7 @@
 
 #include "MulCanonicalizer.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
+#include <moco/IR/TFDialect.h>
 
 #include "TFEltwiseBinaryCanonicalzeHelper.h"
 
@@ -26,7 +25,7 @@ namespace moco
 namespace tf
 {
 
-bool MulCanonicalizer::transform(TFMul *node) const
+bool MulCanonicalizer::transform(moco::TFMul *node) const
 {
   return canonicalize_eltwise_binary_node(node);
 }
index d014031..480eec7 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
@@ -31,13 +32,13 @@ namespace tf
 /**
  * @brief  Convert TFMul to Canonical EltwiseMul
  */
-class MulCanonicalizer : public SimpleNodeTransform<TFMul>
+class MulCanonicalizer : public SimpleNodeTransform<moco::TFMul>
 {
 public:
   const char *name(void) const final { return "MulCanonicalizer"; }
 
 public:
-  bool transform(TFMul *) const final;
+  bool transform(moco::TFMul *) const final;
 };
 
 } // namespace tf
index 4296273..10816f4 100644 (file)
 
 #include "PadCanonicalizer.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
-#include "Dialect/TFNodeVisitor.h"
-#include "Dialect/TFNodeImpl.h"
+#include <moco/IR/TFDialect.h>
 
 #include "loco/Service/TypeInference.h"
 
@@ -28,7 +25,7 @@
 namespace
 {
 
-bool canonicalize_pad(loco::Graph *graph, moco::tf::TFPad *node)
+bool canonicalize_pad(loco::Graph *graph, moco::TFPad *node)
 {
   /**
    * @note This will replace TFPad node with Canonical TensorConstantPad
index 7909da0..64bb604 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 namespace moco
 {
@@ -29,13 +30,13 @@ namespace tf
 /**
  * @brief  Convert TFPad to Canonical TensorConstantPad
  */
-class PadCanonicalizer final : public SimpleNodeTransform<TFPad>
+class PadCanonicalizer final : public SimpleNodeTransform<moco::TFPad>
 {
 public:
   const char *name(void) const final { return "PadCanonicalizer"; }
 
 public:
-  bool transform(TFPad *) const final;
+  bool transform(moco::TFPad *) const final;
 };
 
 } // namespace tf
index e2ca20d..b021fca 100644 (file)
 
 #include "PlaceholderCanonicalizer.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
-#include "Dialect/TFNodeVisitor.h"
-#include "Dialect/TFNodeImpl.h"
+#include <moco/IR/TFDialect.h>
 
 #include <moco/tf/Names.h>
 #include <moco/Log.h>
index 0c6b211..a448d85 100644 (file)
@@ -16,8 +16,7 @@
 
 #include "RealDivCanonicalizer.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
+#include <moco/IR/TFDialect.h>
 
 #include "TFEltwiseBinaryCanonicalzeHelper.h"
 
@@ -26,7 +25,7 @@ namespace moco
 namespace tf
 {
 
-bool RealDivCanonicalizer::transform(TFRealDiv *node) const
+bool RealDivCanonicalizer::transform(moco::TFRealDiv *node) const
 {
   return canonicalize_eltwise_binary_node(node);
 }
index f5387f3..76e1bd3 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
@@ -31,13 +32,13 @@ namespace tf
 /**
  * @brief  Convert TFRealDiv to Canonical EltwiseDiv
  */
-class RealDivCanonicalizer : public SimpleNodeTransform<TFRealDiv>
+class RealDivCanonicalizer : public SimpleNodeTransform<moco::TFRealDiv>
 {
 public:
   const char *name(void) const final { return "RealDivCanonicalizer"; }
 
 public:
-  bool transform(TFRealDiv *) const final;
+  bool transform(moco::TFRealDiv *) const final;
 };
 
 } // namespace tf
index fcd60c9..c53a880 100644 (file)
 
 #include "Relu6Canonicalizer.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
-#include "Dialect/TFNodeVisitor.h"
-#include "Dialect/TFNodeImpl.h"
+#include <moco/IR/TFDialect.h>
 
 #include <stdex/Memory.h>
 
 namespace
 {
 
-bool canonicalize_relu6(loco::Graph *graph, moco::tf::TFRelu6 *node)
+bool canonicalize_relu6(loco::Graph *graph, moco::TFRelu6 *node)
 {
   /**
    * @note This will replace TFRelu6 node with Canonical ReLU6
index 54c40d8..d8ad5db 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
@@ -31,13 +32,13 @@ namespace tf
 /**
  * @brief  Convert TFRelu6 to Canonical ReLU6
  */
-class Relu6Canonicalizer : public SimpleNodeTransform<TFRelu6>
+class Relu6Canonicalizer : public SimpleNodeTransform<moco::TFRelu6>
 {
 public:
   const char *name(void) const final { return "Relu6Canonicalizer"; }
 
 public:
-  bool transform(TFRelu6 *) const final;
+  bool transform(moco::TFRelu6 *) const final;
 };
 
 } // namespace tf
index 47c2d73..7965dc9 100644 (file)
 
 #include "ReluCanonicalizer.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
-#include "Dialect/TFNodeVisitor.h"
-#include "Dialect/TFNodeImpl.h"
+#include <moco/IR/TFDialect.h>
 
 #include <stdex/Memory.h>
 
 namespace
 {
 
-bool canonicalize_relu(loco::Graph *graph, moco::tf::TFRelu *node)
+bool canonicalize_relu(loco::Graph *graph, moco::TFRelu *node)
 {
   /**
    * @note This will replace TFRelu node with Canonical ReLU
index c26820f..e27abe1 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
@@ -31,13 +32,13 @@ namespace tf
 /**
  * @brief  Convert TFRelu to Canonical ReLU
  */
-class ReluCanonicalizer : public SimpleNodeTransform<TFRelu>
+class ReluCanonicalizer : public SimpleNodeTransform<moco::TFRelu>
 {
 public:
   const char *name(void) const final { return "ReluCanonicalizer"; }
 
 public:
-  bool transform(TFRelu *) const final;
+  bool transform(moco::TFRelu *) const final;
 };
 
 } // namespace tf
index 2449cb9..3fa6aae 100644 (file)
@@ -16,8 +16,7 @@
 
 #include "ReshapeCanonicalizer.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodeImpl.h"
+#include <moco/IR/TFDialect.h>
 
 #include <moco/Log.h>
 #include <plier/tf/Convert.h>
@@ -31,7 +30,7 @@ using plier::tf::DataLayout;
 /**
  * @brief  Check whether given 'new shape' arg is a fixed shape input for Reshape
  *
- * ConstNode can be moco::tf::TFConst or loco::ConstGen
+ * ConstNode can be moco::TFConst or loco::ConstGen
  */
 template <typename ConstNode> bool is_fixed_shape_input(ConstNode *const_shape_input)
 {
@@ -60,7 +59,7 @@ template <typename ConstNode> bool is_fixed_shape_input(ConstNode *const_shape_i
 }
 
 /// @note  Currently only supports to canonicalize Fixed Reshape
-bool canonicalize_reshape(loco::Graph *graph, moco::tf::TFReshape *node)
+bool canonicalize_reshape(loco::Graph *graph, moco::TFReshape *node)
 {
   LOGGER(l);
   INFO(l) << "TFNodeCanonicalize TFReshape begin";
@@ -99,7 +98,7 @@ bool canonicalize_reshape(loco::Graph *graph, moco::tf::TFReshape *node)
   // Supports 2 cases for Reshape's shape input:
   //     TF-dialect TFConst or Canonical ConstGen
   loco::Node *shape_input = node->shape();
-  auto tfconst_shape_input = dynamic_cast<moco::tf::TFConst *>(shape_input);
+  auto tfconst_shape_input = dynamic_cast<moco::TFConst *>(shape_input);
   auto constgen_shape_input = dynamic_cast<loco::ConstGen *>(shape_input);
 
   if (tfconst_shape_input)
index 3d6635b..1a79202 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
@@ -31,13 +32,13 @@ namespace tf
 /**
  * @brief  Convert TFReshape to Canonical Reshape
  */
-class ReshapeCanonicalizer : public SimpleNodeTransform<TFReshape>
+class ReshapeCanonicalizer : public SimpleNodeTransform<moco::TFReshape>
 {
 public:
   const char *name(void) const final { return "ReshapeCanonicalizer"; }
 
 public:
-  bool transform(TFReshape *) const final;
+  bool transform(moco::TFReshape *) const final;
 };
 
 } // namespace tf
index 5519069..740d087 100644 (file)
 #include "RsqrtCanonicalizer.h"
 #include "TFShapeInferenceHelper.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
-#include "Dialect/TFNodeVisitor.h"
-#include "Dialect/TFNodeImpl.h"
+#include <moco/IR/TFDialect.h>
 
 #include <moco/Log.h>
 
@@ -68,7 +65,7 @@ void prepare_const_gen<float>(loco::ConstGen *const_node, const loco::TensorShap
   }
 }
 
-bool canonicalize_rsqrt(loco::Graph *graph, moco::tf::TFRsqrt *node)
+bool canonicalize_rsqrt(loco::Graph *graph, moco::TFRsqrt *node)
 {
   /**
    * @note This will replace TFRsqrt node with Canonical EltwiseSqrt + EltwiseRealDiv
index f90e510..7fd4ff6 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
@@ -31,13 +32,13 @@ namespace tf
 /**
  * @brief  Convert TFRsqrt to Canonical EltwiseDiv + EltwiseSqrt
  */
-class RsqrtCanonicalizer : public SimpleNodeTransform<TFRsqrt>
+class RsqrtCanonicalizer : public SimpleNodeTransform<moco::TFRsqrt>
 {
 public:
   const char *name(void) const final { return "RsqrtCanonicalizer"; }
 
 public:
-  bool transform(TFRsqrt *) const final;
+  bool transform(moco::TFRsqrt *) const final;
 };
 
 } // namespace tf
index 7175768..1db4b9a 100644 (file)
 #include "SoftmaxCanonicalizer.h"
 #include "TFShapeInferenceHelper.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
-#include "Dialect/TFNodeVisitor.h"
-#include "Dialect/TFNodeImpl.h"
+#include <moco/IR/TFDialect.h>
 
 #include <moco/Log.h>
 
 namespace
 {
 
-bool canonicalize_softmax(loco::Graph *graph, moco::tf::TFSoftmax *node)
+bool canonicalize_softmax(loco::Graph *graph, moco::TFSoftmax *node)
 {
   LOGGER(l);
 
index f774e85..ebaf04c 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
@@ -31,13 +32,13 @@ namespace tf
 /**
 * @brief Canonicalize TF-dialect TFSoftmax into canonical Softmax node
 */
-class SoftmaxCanonicalizer : public SimpleNodeTransform<TFSoftmax>
+class SoftmaxCanonicalizer : public SimpleNodeTransform<moco::TFSoftmax>
 {
 public:
   const char *name(void) const final { return "SoftmaxCanonicalizer"; }
 
 public:
-  bool transform(TFSoftmax *) const final;
+  bool transform(moco::TFSoftmax *) const final;
 };
 
 } // namespace tf
index e517445..89b9b8a 100644 (file)
 
 #include "SqrtCanonicalizer.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
-#include "Dialect/TFNodeVisitor.h"
-#include "Dialect/TFNodeImpl.h"
+#include <moco/IR/TFDialect.h>
 
 namespace
 {
 
-bool canonicalize_sqrt(loco::Graph *graph, moco::tf::TFSqrt *node)
+bool canonicalize_sqrt(loco::Graph *graph, moco::TFSqrt *node)
 {
   /**
    * @note This will replace TFSqrt node with Canonical EltwiseSqrt
index 4a92011..3f7ffea 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
@@ -31,13 +32,13 @@ namespace tf
 /**
  * @brief  Convert TFsqrt to Canonical EltwiseSqrt
  */
-class SqrtCanonicalizer : public SimpleNodeTransform<TFSqrt>
+class SqrtCanonicalizer : public SimpleNodeTransform<moco::TFSqrt>
 {
 public:
   const char *name(void) const final { return "SqrtCanonicalizer"; }
 
 public:
-  bool transform(TFSqrt *) const final;
+  bool transform(moco::TFSqrt *) const final;
 };
 
 } // namespace tf
index c342866..7756985 100644 (file)
 #include "SqueezeCanonicalizer.h"
 #include "TFShapeInferenceHelper.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
-#include "Dialect/TFNodeVisitor.h"
-#include "Dialect/TFNodeImpl.h"
+#include <moco/IR/TFDialect.h>
 
 #include <moco/Log.h>
 
 namespace
 {
 
-bool canonicalize_squeeze_to_reshape(loco::Graph *graph, moco::tf::TFSqueeze *node)
+bool canonicalize_squeeze_to_reshape(loco::Graph *graph, moco::TFSqueeze *node)
 {
   LOGGER(l);
 
index f62b92c..28a1442 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
@@ -33,13 +34,13 @@ namespace tf
  *
  * @note  There is no canonical Squeeze node
  */
-class SqueezeCanonicalizer : public SimpleNodeTransform<TFSqueeze>
+class SqueezeCanonicalizer : public SimpleNodeTransform<moco::TFSqueeze>
 {
 public:
   const char *name(void) const final { return "SqueezeCanonicalizer"; }
 
 public:
-  bool transform(TFSqueeze *) const final;
+  bool transform(moco::TFSqueeze *) const final;
 };
 
 } // namespace tf
index 652e23b..574fa39 100644 (file)
 
 #include "StopGradientCanonicalizer.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
-#include "Dialect/TFNodeVisitor.h"
-#include "Dialect/TFNodeImpl.h"
+#include <moco/IR/TFDialect.h>
 
 #include <moco/Log.h>
 
 namespace
 {
 
-bool canonicalize_stopgradient(loco::Graph *graph, moco::tf::TFStopGradient *node)
+bool canonicalize_stopgradient(loco::Graph *graph, moco::TFStopGradient *node)
 {
   LOGGER(l);
 
index faf9e39..6a17728 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
@@ -31,13 +32,13 @@ namespace tf
 /**
 * @brief Canonicalize TF-dialect TFStopGradient into canonical Forward node
 */
-class StopGradientCanonicalizer : public SimpleNodeTransform<TFStopGradient>
+class StopGradientCanonicalizer : public SimpleNodeTransform<moco::TFStopGradient>
 {
 public:
   const char *name(void) const final { return "StopGradientCanonicalizer"; }
 
 public:
-  bool transform(TFStopGradient *) const final;
+  bool transform(moco::TFStopGradient *) const final;
 };
 
 } // namespace tf
index dcf9bf5..c518b7d 100644 (file)
@@ -16,8 +16,7 @@
 
 #include "SubCanonicalizer.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
+#include <moco/IR/TFDialect.h>
 
 #include "TFEltwiseBinaryCanonicalzeHelper.h"
 
@@ -26,7 +25,7 @@ namespace moco
 namespace tf
 {
 
-bool SubCanonicalizer::transform(TFSub *node) const
+bool SubCanonicalizer::transform(moco::TFSub *node) const
 {
   return canonicalize_eltwise_binary_node(node);
 }
index 6ca798a..f715cc8 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
@@ -31,13 +32,13 @@ namespace tf
 /**
  * @brief  Convert TFSub to Canonical EltwiseSub
  */
-class SubCanonicalizer : public SimpleNodeTransform<TFSub>
+class SubCanonicalizer : public SimpleNodeTransform<moco::TFSub>
 {
 public:
   const char *name(void) const final { return "SubCanonicalizer"; }
 
 public:
-  bool transform(TFSub *) const final;
+  bool transform(moco::TFSub *) const final;
 };
 
 } // namespace tf
index eb29830..3f48a50 100644 (file)
 
 #include "TanhCanonicalizer.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
-#include "Dialect/TFNodeVisitor.h"
-#include "Dialect/TFNodeImpl.h"
+#include <moco/IR/TFDialect.h>
 
 #include <stdex/Memory.h>
 
 namespace
 {
 
-bool canonicalize_tanh(loco::Graph *graph, moco::tf::TFTanh *node)
+bool canonicalize_tanh(loco::Graph *graph, moco::TFTanh *node)
 {
   /**
    * @note This will replace TFTanh node with Canonical Tanh
index 248c0dc..af5e79f 100644 (file)
@@ -19,7 +19,8 @@
 
 #include "Transform.h"
 #include "SimpleNodeTransform.h"
-#include "Dialect/TFNodes.h"
+
+#include <moco/IR/TFNodes.h>
 
 #include <loco.h>
 
@@ -31,13 +32,13 @@ namespace tf
 /**
  * @brief  Convert TFTanh to Canonical Tanh
  */
-class TanhCanonicalizer : public SimpleNodeTransform<TFTanh>
+class TanhCanonicalizer : public SimpleNodeTransform<moco::TFTanh>
 {
 public:
   const char *name(void) const final { return "TanhCanonicalizer"; }
 
 public:
-  bool transform(TFTanh *) const override;
+  bool transform(moco::TFTanh *) const override;
 };
 
 } // namespace tf
index 700b7e2..5dc400b 100644 (file)
@@ -48,8 +48,8 @@
 #include "Canonicalization/SubCanonicalizer.h"
 #include "Canonicalization/TanhCanonicalizer.h"
 
-#include "Dialect/TFDialect.h"
-#include "Dialect/TFNodes.h"
+#include <moco/IR/TFDialect.h>
+#include <moco/IR/TFNodes.h>
 
 #include <logo/Phase.h>
 
@@ -68,7 +68,7 @@ bool has_tf_nodes(loco::Graph *g)
   auto active_nodes = loco::active_nodes(loco::output_nodes(g));
   for (auto node : active_nodes)
   {
-    if (node->dialect() == moco::tf::TFDialect::get())
+    if (node->dialect() == moco::TFDialect::get())
     {
       return true;
     }
index de8a21b..64ba9df 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "ShapeInferencePass.h"
 
-#include "Dialect/TFDialect.h"
+#include <moco/IR/TFDialect.h>
 
 #include <moco/Service/TFShapeInferenceRule.h>
 
index 92bfd6d..db6cf75 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "TypeInferencePass.h"
 
-#include "Dialect/TFDialect.h"
+#include <moco/IR/TFDialect.h>
 
 #include <moco/Service/TFTypeInferenceRule.h>