From: 이한종/동작제어Lab(SR)/Engineer/삼성전자 Date: Wed, 31 Oct 2018 10:58:29 +0000 (+0900) Subject: [neurun] Introduce iterate method for Context (#3425) X-Git-Tag: 0.3~489 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=646c3c85a215326652995df5be1d3855874e673d;p=platform%2Fcore%2Fml%2Fnnfw.git [neurun] Introduce iterate method for Context (#3425) Introduce `iterate` method for `codegen::operand::Context`. Signed-off-by: Hanjoung Lee --- diff --git a/runtimes/neurun/src/codegen/operand/Context.cc b/runtimes/neurun/src/codegen/operand/Context.cc index 76ba59f..17acca0 100644 --- a/runtimes/neurun/src/codegen/operand/Context.cc +++ b/runtimes/neurun/src/codegen/operand/Context.cc @@ -34,6 +34,14 @@ Context &Context::set(const graph::operand::Index &id, return (*this); } +void Context::iterate(const std::function &fn) +{ + for (auto &e : _objects) + { + fn(e.first, *e.second); + } +} + } // namespace operand } // namespace codegen } // namespace neurun diff --git a/runtimes/neurun/src/codegen/operand/Context.h b/runtimes/neurun/src/codegen/operand/Context.h index b1000a8..3437da2 100644 --- a/runtimes/neurun/src/codegen/operand/Context.h +++ b/runtimes/neurun/src/codegen/operand/Context.h @@ -52,6 +52,8 @@ public: return _objects.at(ind.asInt()); } + void iterate(const std::function &fn); + private: std::map> _objects; };