[loco] Introduce DepthwiseFilerEncode layer (#6668)
author채성우/On-Device Lab(SR)/Engineer/삼성전자 <sw4670.chae@samsung.com>
Mon, 19 Aug 2019 06:40:56 +0000 (15:40 +0900)
committer박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Mon, 19 Aug 2019 06:40:56 +0000 (15:40 +0900)
This commit introduce DepthwiseFilterEncode layer to GraphBuilder.

Signed-off-by: seongwoo <sw4670.chae@samsung.com>
compiler/loco/src/Service/GraphBuilder.h

index 128763d..ac9749e 100644 (file)
@@ -348,6 +348,43 @@ struct FeatureDecodeLayer final
   }
 };
 
+struct DepthwiseFilterEncodeLayer final
+{
+  class Return
+  {
+  public:
+    Return(loco::DepthwiseFilterEncode *node) : _node{node}
+    {
+      // DO NOTHING
+    }
+
+  public:
+    Return *perm(const loco::Permutation<loco::Domain::DepthwiseFilter> &perm)
+    {
+      using namespace loco;
+      _node->encoder(stdex::make_unique<PermutingEncoder<Domain::DepthwiseFilter>>(perm));
+      return this;
+    }
+
+  public:
+    loco::DepthwiseFilterEncode *node(void) { return _node; }
+
+  private:
+    loco::DepthwiseFilterEncode *_node;
+  };
+
+  std::unique_ptr<Return> operator()(GraphBuilder::Context *ctx)
+  {
+    auto encode_node = ctx->graph()->nodes()->create<loco::DepthwiseFilterEncode>();
+
+    encode_node->input(ctx->stack()->pop());
+
+    ctx->stack()->push(encode_node);
+
+    return stdex::make_unique<Return>(encode_node);
+  }
+};
+
 struct FixedReshapeLayer final
 {
   class Return