[enco] Compile ReLU op in Eval instruction (#1813)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Thu, 11 Oct 2018 00:38:32 +0000 (09:38 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Thu, 11 Oct 2018 00:38:32 +0000 (09:38 +0900)
With this commit, ANNOpBuild is now able to compile a simple ReLU op in
Eval instruction.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/enco/core/src/Transforms/Split.cpp

index f0cbfa7..9d7a366 100644 (file)
@@ -403,6 +403,28 @@ public:
         }
       }
     }
+    else if (auto relu = eval->op()->asReLU())
+    {
+      if (auto load = relu->arg()->asLoad())
+      {
+        // Let's compile the following code fragment:
+        //
+        //   %ofm = eval(ReLU(Load(%ifm))
+        //
+        // TODO Support objects of other kinds, such as Tensor
+        auto ifm = load->object()->asFeature();
+        auto ofm = eval->out()->asFeature();
+
+        assert(ifm != nullptr && ofm != nullptr);
+
+        auto app = make_unique<ANNReLUAppender>();
+
+        app->ifm(ifm);
+        app->ofm(ofm);
+
+        return std::move(app);
+      }
+    }
 
     // Return nullptr if a given Eval instruction is incompatible
     return nullptr;