From cf56107950b7b2a592536edb49bcff58c19a56e6 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: Tue, 20 Nov 2018 14:01:14 +0900 Subject: [PATCH] [neurun] Rename Planner as OperationValidator (#3582) Now Planner has only have assertions, so rename accordingly. Signed-off-by: Hanjoung Lee --- .../codegen/{Planner.cc => OperationValidator.cc} | 22 +++++++++++----------- .../codegen/{Planner.h => OperationValidator.h} | 11 +++++------ .../neurun/src/frontend/wrapper/compilation.cc | 5 ++--- 3 files changed, 18 insertions(+), 20 deletions(-) rename runtimes/neurun/src/codegen/{Planner.cc => OperationValidator.cc} (80%) rename runtimes/neurun/src/codegen/{Planner.h => OperationValidator.h} (85%) diff --git a/runtimes/neurun/src/codegen/Planner.cc b/runtimes/neurun/src/codegen/OperationValidator.cc similarity index 80% rename from runtimes/neurun/src/codegen/Planner.cc rename to runtimes/neurun/src/codegen/OperationValidator.cc index a3e494c..9416edf 100644 --- a/runtimes/neurun/src/codegen/Planner.cc +++ b/runtimes/neurun/src/codegen/OperationValidator.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "Planner.h" +#include "OperationValidator.h" #include @@ -29,22 +29,22 @@ namespace neurun namespace codegen { -void Planner::visit(const graph::operation::Conv2DNode &) +void OperationValidator::visit(const graph::operation::Conv2DNode &) { // DO NOTHING } -void Planner::visit(const graph::operation::MaxPool2DNode &) +void OperationValidator::visit(const graph::operation::MaxPool2DNode &) { // DO NOTHING } -void Planner::visit(const graph::operation::AvgPool2DNode &) +void OperationValidator::visit(const graph::operation::AvgPool2DNode &) { // DO NOTHING } -void Planner::visit(const graph::operation::ConcatNode &node) +void OperationValidator::visit(const graph::operation::ConcatNode &node) { (void)node; // NOTE To prevent from unused variable warning @@ -54,12 +54,12 @@ void Planner::visit(const graph::operation::ConcatNode &node) 3); } -void Planner::visit(const graph::operation::FullyConnectedNode &) +void OperationValidator::visit(const graph::operation::FullyConnectedNode &) { // DO NOTHING } -void Planner::visit(const graph::operation::ReshapeNode &node) +void OperationValidator::visit(const graph::operation::ReshapeNode &node) { (void)node; // NOTE To prevent from unused variable warning @@ -83,7 +83,7 @@ void Planner::visit(const graph::operation::ReshapeNode &node) _ctx.at(input_index).shape().dim(2)) == _ctx.at(output_index).shape().dim(1)); } -void Planner::visit(const graph::operation::SoftmaxNode &node) +void OperationValidator::visit(const graph::operation::SoftmaxNode &node) { (void)node; // NOTE To prevent from unused variable warning @@ -101,12 +101,12 @@ void Planner::visit(const graph::operation::SoftmaxNode &node) assert(_ctx.at(input_index).shape().dim(1) == _ctx.at(output_index).shape().dim(1)); } -void Planner::visit(const graph::operation::NOPNode &) +void OperationValidator::visit(const graph::operation::NOPNode &) { // DO NOTHING } -void Planner::visit(const graph::operation::PermuteNode &node) +void OperationValidator::visit(const graph::operation::PermuteNode &node) { (void)node; // NOTE To prevent from unused variable warning @@ -118,7 +118,7 @@ void Planner::visit(const graph::operation::PermuteNode &node) assert(_ctx.at(output_index).shape().rank() == _ctx.at(input_index).shape().rank()); } -void Planner::visit(const graph::operation::AddNode &) +void OperationValidator::visit(const graph::operation::AddNode &) { // DO NOTHING } diff --git a/runtimes/neurun/src/codegen/Planner.h b/runtimes/neurun/src/codegen/OperationValidator.h similarity index 85% rename from runtimes/neurun/src/codegen/Planner.h rename to runtimes/neurun/src/codegen/OperationValidator.h index d97aeed..a325bb0 100644 --- a/runtimes/neurun/src/codegen/Planner.h +++ b/runtimes/neurun/src/codegen/OperationValidator.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __NEURUN_CODEGEN_PLANNER_H__ -#define __NEURUN_CODEGEN_PLANNER_H__ +#ifndef __NEURUN_CODEGEN_OPERATION_VALIDATOR_H__ +#define __NEURUN_CODEGEN_OPERATION_VALIDATOR_H__ #include "graph/operation/NodeVisitor.h" @@ -35,11 +35,10 @@ namespace neurun namespace codegen { -// FIXME Rename Planner to OperationAsserter -class Planner : public graph::operation::NodeVisitor +class OperationValidator : public graph::operation::NodeVisitor { public: - Planner(const neurun::graph::operand::Set &ctx) : _ctx{ctx} {} + OperationValidator(const neurun::graph::operand::Set &ctx) : _ctx{ctx} {} public: virtual void visit(const graph::operation::Conv2DNode &) override; @@ -60,4 +59,4 @@ private: } // namespace codegen } // namespace neurun -#endif // __NEURUN_CODEGEN_PLANNER_H__ +#endif // __NEURUN_CODEGEN_OPERATION_VALIDATOR_H__ diff --git a/runtimes/neurun/src/frontend/wrapper/compilation.cc b/runtimes/neurun/src/frontend/wrapper/compilation.cc index 45700e5..2aec8ad 100644 --- a/runtimes/neurun/src/frontend/wrapper/compilation.cc +++ b/runtimes/neurun/src/frontend/wrapper/compilation.cc @@ -20,7 +20,7 @@ #include "graph/dumper/Dumper.h" #include "dumper/dot/DotDumper.h" #include "codegen/IPlanBuilder.h" -#include "codegen/Planner.h" +#include "codegen/OperationValidator.h" #include "codegen/PlanBuilder.h" #include "middleend/SubTensorAnalyzer.h" #include "codegen/ConstantInitializer.h" @@ -67,8 +67,7 @@ int ANeuralNetworksCompilation::finish() neurun::codegen::PlanBuilder plan_builder{plan}; - // NOTE This is actually an Asserter. Will be renamed - linear->accept(neurun::codegen::Planner{operands}); + linear->accept(neurun::codegen::OperationValidator{operands}); // Plan building linear->iterate([&](const neurun::graph::operation::Node *node) { -- 2.7.4