[enco] Identify ANN input/output with ANN bags method (#1960)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Wed, 24 Oct 2018 08:18:26 +0000 (17:18 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Wed, 24 Oct 2018 08:18:26 +0000 (17:18 +0900)
* [enco] Identify ANN input/output with ANN bags method

This commit refines the implementation of ANNModuleBuilder to use bags
method in ANNBinder instead of reads/updates method.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
* Remove unused 'block' variable

contrib/enco/core/src/Transforms/Split.cpp

index 6fa9100..dba8172 100644 (file)
@@ -844,21 +844,21 @@ void ANNGroupBuilder::build(enco::Code *code) const
 class ANNModuleBuilder
 {
 private:
-  std::set<coco::Bag *> inputs(coco::Block *blk) const;
-  std::set<coco::Bag *> outputs(coco::Block *blk) const;
+  std::set<coco::Bag *> inputs(ANNBinder *binder) const;
+  std::set<coco::Bag *> outputs(ANNBinder *binder) const;
 
 public:
   void build(ANNContext *ann_ctx) const;
 };
 
-std::set<coco::Bag *> ANNModuleBuilder::inputs(coco::Block *blk) const
+std::set<coco::Bag *> ANNModuleBuilder::inputs(ANNBinder *binder) const
 {
   std::set<coco::Bag *> res;
 
-  for (auto bag : enco::reads(blk))
+  for (auto bag : binder->bags())
   {
     auto u = enco::updaters(bag);
-    u.erase(blk);
+    u.erase(binder->block());
 
     /**
      * A bag is the input of this block if
@@ -874,14 +874,14 @@ std::set<coco::Bag *> ANNModuleBuilder::inputs(coco::Block *blk) const
   return res;
 }
 
-std::set<coco::Bag *> ANNModuleBuilder::outputs(coco::Block *blk) const
+std::set<coco::Bag *> ANNModuleBuilder::outputs(ANNBinder *binder) const
 {
   std::set<coco::Bag *> res;
 
-  for (auto bag : enco::updates(blk))
+  for (auto bag : binder->bags())
   {
     auto r = enco::readers(bag);
-    r.erase(blk);
+    r.erase(binder->block());
 
     /**
      * A bag is the output of this block if
@@ -902,11 +902,10 @@ void ANNModuleBuilder::build(ANNContext *ann_ctx) const
   for (uint32_t n = 0; n < ann_ctx->count(); ++n)
   {
     auto binder = ann_ctx->nth(n);
-    auto block = binder->block();
 
     // Let's identify input/output bags
-    binder->identifyInputs(inputs(binder->block()));
-    binder->identifyOutputs(outputs(binder->block()));
+    binder->identifyInputs(inputs(binder));
+    binder->identifyOutputs(outputs(binder));
   }
 }