[enco] Extend ANNBinder with bags method (#1959)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Wed, 24 Oct 2018 02:12:47 +0000 (11:12 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Wed, 24 Oct 2018 02:12:47 +0000 (11:12 +0900)
This commit extends ANNBinder with bags method which enumerates all the
bags that the current ANN subnet accesses during evaluation.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/enco/core/src/ANN/Binder.h

index 09a012a..2cfb36f 100644 (file)
@@ -45,6 +45,22 @@ public:
   const ann::Module *module(void) const { return _module.get(); }
 
 public:
+  /**
+   * @brief Return the set of bags that the current ANN subnet accesses
+   */
+  std::set<coco::Bag *> bags(void) const
+  {
+    std::set<coco::Bag *> res;
+
+    for (auto it = _operands.begin(); it != _operands.end(); ++it)
+    {
+      res.insert(it->first);
+    }
+
+    return res;
+  }
+
+public:
   template <typename T> ann::OperandID addOperand(void)
   {
     return _module->operand()->create(ann::dtype<T>());
@@ -177,7 +193,7 @@ private:
 
 private:
   // @brief Operand ID assigned for each coco::Bag
-  std::map<const coco::Bag *, ann::OperandID> _operands;
+  std::map<coco::Bag *, ann::OperandID> _operands;
 };
 
 #endif // __ANN_BINDER_H__