From 646c3c85a215326652995df5be1d3855874e673d Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9D=B4=ED=95=9C=EC=A2=85/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Engineer/=EC=82=BC=EC=84=B1=EC=A0=84?= =?utf8?q?=EC=9E=90?= Date: Wed, 31 Oct 2018 19:58:29 +0900 Subject: [PATCH] [neurun] Introduce iterate method for Context (#3425) Introduce `iterate` method for `codegen::operand::Context`. Signed-off-by: Hanjoung Lee --- runtimes/neurun/src/codegen/operand/Context.cc | 8 ++++++++ runtimes/neurun/src/codegen/operand/Context.h | 2 ++ 2 files changed, 10 insertions(+) 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; }; -- 2.7.4