[neurun] Introduce iterate method for Context (#3425)
author이한종/동작제어Lab(SR)/Engineer/삼성전자 <hanjoung.lee@samsung.com>
Wed, 31 Oct 2018 10:58:29 +0000 (19:58 +0900)
committer오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Wed, 31 Oct 2018 10:58:29 +0000 (19:58 +0900)
Introduce `iterate` method for `codegen::operand::Context`.

Signed-off-by: Hanjoung Lee <hanjoung.lee@samsung.com>
runtimes/neurun/src/codegen/operand/Context.cc
runtimes/neurun/src/codegen/operand/Context.h

index 76ba59f..17acca0 100644 (file)
@@ -34,6 +34,14 @@ Context &Context::set(const graph::operand::Index &id,
   return (*this);
 }
 
+void Context::iterate(const std::function<void(int, backend::operand::IObject &)> &fn)
+{
+  for (auto &e : _objects)
+  {
+    fn(e.first, *e.second);
+  }
+}
+
 } // namespace operand
 } // namespace codegen
 } // namespace neurun
index b1000a8..3437da2 100644 (file)
@@ -52,6 +52,8 @@ public:
     return _objects.at(ind.asInt());
   }
 
+  void iterate(const std::function<void(int, backend::operand::IObject &)> &fn);
+
 private:
   std::map<int, std::shared_ptr<backend::operand::IObject>> _objects;
 };