From 5286d414200b954a5bdd6bcb9fb81d422234cd86 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9D=B4=ED=95=9C=EC=A2=85/On-Device=20Lab=28SR=29/Enginee?= =?utf8?q?r/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Tue, 18 Dec 2018 19:12:13 +0900 Subject: [PATCH] [neurun] Move operation files from graph to model (#4095) * [neurun] Move operation files from graph to model Move pure model related classes from `graph/operaation` to `model/operation`. Signed-off-by: Hanjoung Lee * Update ifdef guards * Fix ifdef guards --- .../neurun/src/backend/acl_cl/StageGenerator.cc | 30 ++++++------- .../neurun/src/backend/acl_cl/StageGenerator.h | 4 +- runtimes/neurun/src/backend/cpu/StageGenerator.cc | 30 ++++++------- runtimes/neurun/src/backend/cpu/StageGenerator.h | 4 +- .../neurun/src/backend/interface/IStageGenerator.h | 10 ++--- runtimes/neurun/src/compiler/BackendResolver.h | 8 ++-- runtimes/neurun/src/compiler/Compiler.cc | 2 +- .../neurun/src/compiler/ConstantInitializer.cc | 6 +-- runtimes/neurun/src/compiler/OperationValidator.cc | 18 ++++---- runtimes/neurun/src/compiler/OperationValidator.h | 8 ++-- runtimes/neurun/src/compiler/PlanBuilder.cc | 2 +- runtimes/neurun/src/compiler/SubTensorAnalyzer.cc | 2 +- runtimes/neurun/src/compiler/SubTensorAnalyzer.h | 6 +-- runtimes/neurun/src/dumper/dot/DotBuilder.h | 6 +-- runtimes/neurun/src/dumper/dot/DotDumper.cc | 2 +- runtimes/neurun/src/dumper/dot/DotNodeInfo.cc | 4 +- runtimes/neurun/src/dumper/dot/DotNodeInfo.h | 12 ++--- runtimes/neurun/src/frontend/model.cc | 18 ++++---- runtimes/neurun/src/frontend/wrapper/model.cc | 2 +- runtimes/neurun/src/frontend/wrapper/model.h | 4 +- runtimes/neurun/src/graph/Graph.cc | 52 +++++++++++----------- runtimes/neurun/src/graph/Graph.h | 12 ++--- runtimes/neurun/src/graph/Model.h | 4 +- runtimes/neurun/src/graph/dumper/Dumper.cc | 2 +- runtimes/neurun/src/graph/dumper/Dumper.h | 22 ++++----- runtimes/neurun/src/graph/pass/OperationPass.cc | 4 +- runtimes/neurun/src/graph/pass/OperationPass.h | 6 +-- .../src/graph/pass/PermutationInsertionPass.cc | 17 +++---- .../src/graph/pass/PermutationInsertionPass.h | 8 ++-- runtimes/neurun/src/graph/verifier/Verifier.cc | 13 +++--- runtimes/neurun/src/linear/Linear.cc | 6 +-- runtimes/neurun/src/linear/Linear.h | 8 ++-- runtimes/neurun/src/model/operand/Object.cc | 8 ++-- runtimes/neurun/src/model/operand/Object.h | 18 ++++---- .../src/{graph => model}/operation/AddNode.cc | 8 ++-- .../src/{graph => model}/operation/AddNode.h | 16 +++---- .../{graph => model}/operation/AvgPool2DNode.cc | 9 ++-- .../src/{graph => model}/operation/AvgPool2DNode.h | 16 +++---- .../src/{graph => model}/operation/ConcatNode.cc | 9 ++-- .../src/{graph => model}/operation/ConcatNode.h | 16 +++---- .../src/{graph => model}/operation/Conv2DNode.cc | 9 ++-- .../src/{graph => model}/operation/Conv2DNode.h | 16 +++---- .../operation/FullyConnectedNode.cc | 9 ++-- .../operation/FullyConnectedNode.h | 16 +++---- .../neurun/src/{graph => model}/operation/Index.h | 10 ++--- .../src/{graph => model}/operation/IndexList.cc | 6 +-- .../src/{graph => model}/operation/IndexList.h | 10 ++--- .../{graph => model}/operation/MaxPool2DNode.cc | 9 ++-- .../src/{graph => model}/operation/MaxPool2DNode.h | 16 +++---- .../src/{graph => model}/operation/Node.Include.h | 0 .../neurun/src/{graph => model}/operation/Node.cc | 10 ++--- .../neurun/src/{graph => model}/operation/Node.h | 27 +++++------ .../src/{graph => model}/operation/NodeVisitor.h | 12 ++--- .../neurun/src/{graph => model}/operation/Op.lst | 0 .../operation/OperandConstraint.cc | 4 +- .../{graph => model}/operation/OperandConstraint.h | 10 ++--- .../src/{graph => model}/operation/PermuteNode.cc | 6 +-- .../src/{graph => model}/operation/PermuteNode.h | 14 +++--- .../src/{graph => model}/operation/ReshapeNode.cc | 9 ++-- .../src/{graph => model}/operation/ReshapeNode.h | 16 +++---- .../neurun/src/{graph => model}/operation/Set.cc | 4 +- .../neurun/src/{graph => model}/operation/Set.h | 12 ++--- .../src/{graph => model}/operation/SoftmaxNode.cc | 9 ++-- .../src/{graph => model}/operation/SoftmaxNode.h | 16 +++---- runtimes/neurun/src/util/config/Config.lst | 2 +- runtimes/neurun/test/graph/MockNode.h | 12 ++--- runtimes/neurun/test/graph/operation/Set.cc | 8 ++-- runtimes/neurun/test/graph/operation/SetIO.cc | 10 ++--- runtimes/neurun/test/graph/verifier/Verifier.cc | 2 +- 69 files changed, 354 insertions(+), 362 deletions(-) rename runtimes/neurun/src/{graph => model}/operation/AddNode.cc (87%) rename runtimes/neurun/src/{graph => model}/operation/AddNode.h (75%) rename runtimes/neurun/src/{graph => model}/operation/AvgPool2DNode.cc (90%) rename runtimes/neurun/src/{graph => model}/operation/AvgPool2DNode.h (78%) rename runtimes/neurun/src/{graph => model}/operation/ConcatNode.cc (88%) rename runtimes/neurun/src/{graph => model}/operation/ConcatNode.h (76%) rename runtimes/neurun/src/{graph => model}/operation/Conv2DNode.cc (90%) rename runtimes/neurun/src/{graph => model}/operation/Conv2DNode.h (78%) rename runtimes/neurun/src/{graph => model}/operation/FullyConnectedNode.cc (88%) rename runtimes/neurun/src/{graph => model}/operation/FullyConnectedNode.h (75%) rename runtimes/neurun/src/{graph => model}/operation/Index.h (83%) rename runtimes/neurun/src/{graph => model}/operation/IndexList.cc (90%) rename runtimes/neurun/src/{graph => model}/operation/IndexList.h (87%) rename runtimes/neurun/src/{graph => model}/operation/MaxPool2DNode.cc (90%) rename runtimes/neurun/src/{graph => model}/operation/MaxPool2DNode.h (78%) rename runtimes/neurun/src/{graph => model}/operation/Node.Include.h (100%) rename runtimes/neurun/src/{graph => model}/operation/Node.cc (84%) rename runtimes/neurun/src/{graph => model}/operation/Node.h (76%) rename runtimes/neurun/src/{graph => model}/operation/NodeVisitor.h (80%) rename runtimes/neurun/src/{graph => model}/operation/Op.lst (100%) rename runtimes/neurun/src/{graph => model}/operation/OperandConstraint.cc (95%) rename runtimes/neurun/src/{graph => model}/operation/OperandConstraint.h (88%) rename runtimes/neurun/src/{graph => model}/operation/PermuteNode.cc (90%) rename runtimes/neurun/src/{graph => model}/operation/PermuteNode.h (77%) rename runtimes/neurun/src/{graph => model}/operation/ReshapeNode.cc (88%) rename runtimes/neurun/src/{graph => model}/operation/ReshapeNode.h (73%) rename runtimes/neurun/src/{graph => model}/operation/Set.cc (97%) rename runtimes/neurun/src/{graph => model}/operation/Set.h (87%) rename runtimes/neurun/src/{graph => model}/operation/SoftmaxNode.cc (87%) rename runtimes/neurun/src/{graph => model}/operation/SoftmaxNode.h (76%) diff --git a/runtimes/neurun/src/backend/acl_cl/StageGenerator.cc b/runtimes/neurun/src/backend/acl_cl/StageGenerator.cc index 8773cf0..915cf14 100644 --- a/runtimes/neurun/src/backend/acl_cl/StageGenerator.cc +++ b/runtimes/neurun/src/backend/acl_cl/StageGenerator.cc @@ -131,9 +131,9 @@ StageGenerator::StageGenerator(const neurun::model::operand::Set &ctx, // DO NOTHING } -void StageGenerator::visit(const graph::operation::Conv2DNode &node) +void StageGenerator::visit(const model::operation::Conv2DNode &node) { - using graph::operation::Conv2DNode; + using model::operation::Conv2DNode; const auto ofm_index{node.getOutputs().at(0)}; const auto ifm_index{node.getInputs().at(Conv2DNode::Input::INPUT)}; @@ -213,10 +213,10 @@ void StageGenerator::visit(const graph::operation::Conv2DNode &node) }); } -void StageGenerator::visit(const graph::operation::MaxPool2DNode &node) +void StageGenerator::visit(const model::operation::MaxPool2DNode &node) { const auto ofm_index{node.getOutputs().at(0)}; - const auto ifm_index{node.getInputs().at(graph::operation::MaxPool2DNode::Input::INPUT)}; + const auto ifm_index{node.getInputs().at(model::operation::MaxPool2DNode::Input::INPUT)}; const auto kh_index{node.param().kh_index}; const auto kw_index{node.param().kw_index}; @@ -301,10 +301,10 @@ void StageGenerator::visit(const graph::operation::MaxPool2DNode &node) }); } -void StageGenerator::visit(const graph::operation::AvgPool2DNode &node) +void StageGenerator::visit(const model::operation::AvgPool2DNode &node) { const auto ofm_index{node.getOutputs().at(0)}; - const auto ifm_index{node.getInputs().at(graph::operation::AvgPool2DNode::Input::INPUT)}; + const auto ifm_index{node.getInputs().at(model::operation::AvgPool2DNode::Input::INPUT)}; const auto kh_index{node.param().kh_index}; const auto kw_index{node.param().kw_index}; @@ -393,7 +393,7 @@ void StageGenerator::visit(const graph::operation::AvgPool2DNode &node) }); } -void StageGenerator::visit(const graph::operation::ConcatNode &node) +void StageGenerator::visit(const model::operation::ConcatNode &node) { const auto ofm_index{node.getOutputs().at(0)}; const auto axis_index{node.param().axis_index}; @@ -455,9 +455,9 @@ void StageGenerator::visit(const graph::operation::ConcatNode &node) }); } -void StageGenerator::visit(const graph::operation::FullyConnectedNode &node) +void StageGenerator::visit(const model::operation::FullyConnectedNode &node) { - using graph::operation::FullyConnectedNode; + using model::operation::FullyConnectedNode; const auto output_index{node.getOutputs().at(0)}; const auto input_index{node.getInputs().at(FullyConnectedNode::Input::INPUT)}; @@ -507,10 +507,10 @@ void StageGenerator::visit(const graph::operation::FullyConnectedNode &node) }); } -void StageGenerator::visit(const graph::operation::ReshapeNode &node) +void StageGenerator::visit(const model::operation::ReshapeNode &node) { const auto output_index{node.getOutputs().at(0)}; - const auto input_index{node.getInputs().at(graph::operation::ReshapeNode::Input::INPUT)}; + const auto input_index{node.getInputs().at(model::operation::ReshapeNode::Input::INPUT)}; struct Param { @@ -539,10 +539,10 @@ void StageGenerator::visit(const graph::operation::ReshapeNode &node) }); } -void StageGenerator::visit(const graph::operation::SoftmaxNode &node) +void StageGenerator::visit(const model::operation::SoftmaxNode &node) { const auto output_index{node.getOutputs().at(0)}; - const auto input_index{node.getInputs().at(graph::operation::SoftmaxNode::Input::INPUT)}; + const auto input_index{node.getInputs().at(model::operation::SoftmaxNode::Input::INPUT)}; const auto scale_index{node.param().scale_index}; assert(_ctx.at(scale_index).shape().rank() == 0); @@ -576,12 +576,12 @@ void StageGenerator::visit(const graph::operation::SoftmaxNode &node) }); } -void StageGenerator::visit(const graph::operation::PermuteNode & /* node */) +void StageGenerator::visit(const model::operation::PermuteNode & /* node */) { throw "Unsupported"; } -void StageGenerator::visit(const graph::operation::AddNode &) +void StageGenerator::visit(const model::operation::AddNode &) { VERBOSE(Add) << "generate CPU Add" << std::endl; diff --git a/runtimes/neurun/src/backend/acl_cl/StageGenerator.h b/runtimes/neurun/src/backend/acl_cl/StageGenerator.h index fd6bd41..1dac259 100644 --- a/runtimes/neurun/src/backend/acl_cl/StageGenerator.h +++ b/runtimes/neurun/src/backend/acl_cl/StageGenerator.h @@ -38,8 +38,8 @@ public: virtual std::shared_ptr tensor_builder() override { return _tensor_builder; } #define OP(InternalName, IsNnApi, NnApiName) \ - virtual void visit(const graph::operation::InternalName &) override; -#include "graph/operation/Op.lst" + virtual void visit(const model::operation::InternalName &) override; +#include "model/operation/Op.lst" #undef OP private: diff --git a/runtimes/neurun/src/backend/cpu/StageGenerator.cc b/runtimes/neurun/src/backend/cpu/StageGenerator.cc index 28b9583..c218be6 100644 --- a/runtimes/neurun/src/backend/cpu/StageGenerator.cc +++ b/runtimes/neurun/src/backend/cpu/StageGenerator.cc @@ -50,9 +50,9 @@ StageGenerator::StageGenerator(const neurun::model::operand::Set &operand_ctx, // DO NOTHING } -void StageGenerator::visit(const graph::operation::Conv2DNode &node) +void StageGenerator::visit(const model::operation::Conv2DNode &node) { - using graph::operation::Conv2DNode; + using model::operation::Conv2DNode; const auto ofm_index{node.getOutputs().at(0)}; const auto ifm_index{node.getInputs().at(Conv2DNode::Input::INPUT)}; @@ -137,12 +137,12 @@ void StageGenerator::visit(const graph::operation::Conv2DNode &node) }); } -void StageGenerator::visit(const graph::operation::MaxPool2DNode &node) +void StageGenerator::visit(const model::operation::MaxPool2DNode &node) { VERBOSE(MaxPool2D) << "generate CPU MaxPool2D" << std::endl; const auto ofm_index{node.getOutputs().at(0)}; - const auto ifm_index{node.getInputs().at(graph::operation::MaxPool2DNode::Input::INPUT)}; + const auto ifm_index{node.getInputs().at(model::operation::MaxPool2DNode::Input::INPUT)}; const auto kh_index{node.param().kh_index}; const auto kw_index{node.param().kw_index}; @@ -233,12 +233,12 @@ void StageGenerator::visit(const graph::operation::MaxPool2DNode &node) }); } -void StageGenerator::visit(const graph::operation::AvgPool2DNode &node) +void StageGenerator::visit(const model::operation::AvgPool2DNode &node) { VERBOSE(AvgPool2D) << "generate CPU AvgPool2D" << std::endl; const auto ofm_index{node.getOutputs().at(0)}; - const auto ifm_index{node.getInputs().at(graph::operation::AvgPool2DNode::Input::INPUT)}; + const auto ifm_index{node.getInputs().at(model::operation::AvgPool2DNode::Input::INPUT)}; const auto kh_index{node.param().kh_index}; const auto kw_index{node.param().kw_index}; @@ -333,7 +333,7 @@ void StageGenerator::visit(const graph::operation::AvgPool2DNode &node) }); } -void StageGenerator::visit(const graph::operation::ConcatNode &node) +void StageGenerator::visit(const model::operation::ConcatNode &node) { VERBOSE(Concat) << "generate CPU Concat" << std::endl; @@ -387,11 +387,11 @@ void StageGenerator::visit(const graph::operation::ConcatNode &node) }); } -void StageGenerator::visit(const graph::operation::FullyConnectedNode &node) +void StageGenerator::visit(const model::operation::FullyConnectedNode &node) { VERBOSE(FullyConnected) << "generate CPU FullyConnected" << std::endl; - using graph::operation::FullyConnectedNode; + using model::operation::FullyConnectedNode; const auto output_index{node.getOutputs().at(0)}; const auto input_index{node.getInputs().at(FullyConnectedNode::Input::INPUT)}; @@ -448,10 +448,10 @@ void StageGenerator::visit(const graph::operation::FullyConnectedNode &node) }); } -void StageGenerator::visit(const graph::operation::ReshapeNode &node) +void StageGenerator::visit(const model::operation::ReshapeNode &node) { const auto output_index{node.getOutputs().at(0)}; - const auto input_index{node.getInputs().at(graph::operation::ReshapeNode::Input::INPUT)}; + const auto input_index{node.getInputs().at(model::operation::ReshapeNode::Input::INPUT)}; struct Param { @@ -485,12 +485,12 @@ void StageGenerator::visit(const graph::operation::ReshapeNode &node) }); } -void StageGenerator::visit(const graph::operation::SoftmaxNode &node) +void StageGenerator::visit(const model::operation::SoftmaxNode &node) { VERBOSE(Softmax) << "generate CPU Softmax" << std::endl; const auto output_index{node.getOutputs().at(0)}; - const auto input_index{node.getInputs().at(graph::operation::SoftmaxNode::Input::INPUT)}; + const auto input_index{node.getInputs().at(model::operation::SoftmaxNode::Input::INPUT)}; const auto scale_index{node.param().scale_index}; struct Param @@ -530,7 +530,7 @@ void StageGenerator::visit(const graph::operation::SoftmaxNode &node) }); } -void StageGenerator::visit(const graph::operation::PermuteNode &node) +void StageGenerator::visit(const model::operation::PermuteNode &node) { VERBOSE(Permute) << "generate CPU Permute" << std::endl; @@ -593,7 +593,7 @@ void StageGenerator::visit(const graph::operation::PermuteNode &node) }); } -void StageGenerator::visit(const graph::operation::AddNode &) +void StageGenerator::visit(const model::operation::AddNode &) { VERBOSE(Add) << "generate CPU Add" << std::endl; diff --git a/runtimes/neurun/src/backend/cpu/StageGenerator.h b/runtimes/neurun/src/backend/cpu/StageGenerator.h index 88c1e28..6a0e387 100644 --- a/runtimes/neurun/src/backend/cpu/StageGenerator.h +++ b/runtimes/neurun/src/backend/cpu/StageGenerator.h @@ -39,8 +39,8 @@ public: virtual std::shared_ptr tensor_builder() override { return _tensor_builder; } #define OP(InternalName, IsNnApi, NnApiName) \ - virtual void visit(const graph::operation::InternalName &) override; -#include "graph/operation/Op.lst" + virtual void visit(const model::operation::InternalName &) override; +#include "model/operation/Op.lst" #undef OP private: diff --git a/runtimes/neurun/src/backend/interface/IStageGenerator.h b/runtimes/neurun/src/backend/interface/IStageGenerator.h index 4152d0a..878a50e 100644 --- a/runtimes/neurun/src/backend/interface/IStageGenerator.h +++ b/runtimes/neurun/src/backend/interface/IStageGenerator.h @@ -23,7 +23,7 @@ #include "exec/interface/IFunction.h" #include "backend/interface/ITensorBuilder.h" -#include "graph/operation/NodeVisitor.h" +#include "model/operation/NodeVisitor.h" struct IExecutionBuilder { @@ -39,7 +39,7 @@ namespace neurun namespace backend { -class IStageGenerator : graph::operation::NodeVisitor +class IStageGenerator : model::operation::NodeVisitor { public: virtual ~IStageGenerator() = default; @@ -48,15 +48,15 @@ public: protected: #define OP(InternalName, IsNnApi, NnApiName) \ - virtual void visit(const graph::operation::InternalName &) override {} -#include "graph/operation/Op.lst" + virtual void visit(const model::operation::InternalName &) override {} +#include "model/operation/Op.lst" #undef OP protected: void returnStage(const Stage &stage) { _return = stage; } public: - Stage generate(const graph::operation::Node &node) + Stage generate(const model::operation::Node &node) { node.accept(std::move(*this)); return _return; diff --git a/runtimes/neurun/src/compiler/BackendResolver.h b/runtimes/neurun/src/compiler/BackendResolver.h index 9a4b776..4742b2d 100644 --- a/runtimes/neurun/src/compiler/BackendResolver.h +++ b/runtimes/neurun/src/compiler/BackendResolver.h @@ -47,9 +47,9 @@ public: if (IsNnApi) \ { \ auto backend = _backend_manager->get(backend_all_str); \ - _gen_map[typeid(graph::operation::InternalName)] = backend; \ + _gen_map[typeid(model::operation::InternalName)] = backend; \ } -#include "graph/operation/Op.lst" +#include "model/operation/Op.lst" #undef OP } else @@ -61,10 +61,10 @@ public: config::ConfigManager::instance().get("OP_BACKEND_" #NnApiName); \ auto backend = _backend_manager->get(backend_str); \ VERBOSE(BackendResolver) << "backend for " << #NnApiName << ": " << backend_str << std::endl; \ - _gen_map[typeid(graph::operation::InternalName)] = backend; \ + _gen_map[typeid(model::operation::InternalName)] = backend; \ } -#include "graph/operation/Op.lst" +#include "model/operation/Op.lst" #undef OP } } diff --git a/runtimes/neurun/src/compiler/Compiler.cc b/runtimes/neurun/src/compiler/Compiler.cc index 28606bd..dc9f800 100644 --- a/runtimes/neurun/src/compiler/Compiler.cc +++ b/runtimes/neurun/src/compiler/Compiler.cc @@ -97,7 +97,7 @@ void Compiler::compile(void) PlanBuilder plan_builder{plan}; // Plan building - linear->iterate([&](const neurun::graph::operation::Node *node) { + linear->iterate([&](const neurun::model::operation::Node *node) { auto backend = node->lower_info()->backend(); // Generate Stage diff --git a/runtimes/neurun/src/compiler/ConstantInitializer.cc b/runtimes/neurun/src/compiler/ConstantInitializer.cc index f71d890..d6d58e2 100644 --- a/runtimes/neurun/src/compiler/ConstantInitializer.cc +++ b/runtimes/neurun/src/compiler/ConstantInitializer.cc @@ -19,7 +19,7 @@ #include "backend/interface/operand/IObject.h" #include "backend/interface/IConfig.h" #include "backend/BackendManager.h" -#include "graph/operation/FullyConnectedNode.h" +#include "model/operation/FullyConnectedNode.h" #include "util/feature/nhwc/Reader.h" #include "util/feature/nhwc/View.h" #include "util/feature/nchw/View.h" @@ -89,13 +89,13 @@ void ConstantInitializer::operator()() auto operation_index = _graph.operands().at(index).getUses().list().front(); auto operation = &_graph.operations().at(operation_index); auto fc_operation = - dynamic_cast(operation); + dynamic_cast(operation); if (fc_operation == nullptr) break; auto ifm_index = fc_operation->getInputs().at( - neurun::graph::operation::FullyConnectedNode::Input::INPUT); + neurun::model::operation::FullyConnectedNode::Input::INPUT); const auto &ifm = _graph.operands().at(ifm_index); const auto ifm_shape = ifm.shape().asFeature(); const auto num_output = shape.dim(0); diff --git a/runtimes/neurun/src/compiler/OperationValidator.cc b/runtimes/neurun/src/compiler/OperationValidator.cc index b9e07bf..0110ecc 100644 --- a/runtimes/neurun/src/compiler/OperationValidator.cc +++ b/runtimes/neurun/src/compiler/OperationValidator.cc @@ -28,22 +28,22 @@ namespace neurun namespace compiler { -void OperationValidator::visit(const graph::operation::Conv2DNode &) +void OperationValidator::visit(const model::operation::Conv2DNode &) { // DO NOTHING } -void OperationValidator::visit(const graph::operation::MaxPool2DNode &) +void OperationValidator::visit(const model::operation::MaxPool2DNode &) { // DO NOTHING } -void OperationValidator::visit(const graph::operation::AvgPool2DNode &) +void OperationValidator::visit(const model::operation::AvgPool2DNode &) { // DO NOTHING } -void OperationValidator::visit(const graph::operation::ConcatNode &node) +void OperationValidator::visit(const model::operation::ConcatNode &node) { (void)node; // NOTE To prevent from unused variable warning @@ -53,12 +53,12 @@ void OperationValidator::visit(const graph::operation::ConcatNode &node) 3); } -void OperationValidator::visit(const graph::operation::FullyConnectedNode &) +void OperationValidator::visit(const model::operation::FullyConnectedNode &) { // DO NOTHING } -void OperationValidator::visit(const graph::operation::ReshapeNode &node) +void OperationValidator::visit(const model::operation::ReshapeNode &node) { (void)node; // NOTE To prevent from unused variable warning @@ -82,7 +82,7 @@ void OperationValidator::visit(const graph::operation::ReshapeNode &node) _ctx.at(input_index).shape().dim(2)) == _ctx.at(output_index).shape().dim(1)); } -void OperationValidator::visit(const graph::operation::SoftmaxNode &node) +void OperationValidator::visit(const model::operation::SoftmaxNode &node) { (void)node; // NOTE To prevent from unused variable warning @@ -100,7 +100,7 @@ void OperationValidator::visit(const graph::operation::SoftmaxNode &node) assert(_ctx.at(input_index).shape().dim(1) == _ctx.at(output_index).shape().dim(1)); } -void OperationValidator::visit(const graph::operation::PermuteNode &node) +void OperationValidator::visit(const model::operation::PermuteNode &node) { (void)node; // NOTE To prevent from unused variable warning @@ -112,7 +112,7 @@ void OperationValidator::visit(const graph::operation::PermuteNode &node) assert(_ctx.at(output_index).shape().rank() == _ctx.at(input_index).shape().rank()); } -void OperationValidator::visit(const graph::operation::AddNode &) +void OperationValidator::visit(const model::operation::AddNode &) { // DO NOTHING } diff --git a/runtimes/neurun/src/compiler/OperationValidator.h b/runtimes/neurun/src/compiler/OperationValidator.h index 510a7cd..f4ed533 100644 --- a/runtimes/neurun/src/compiler/OperationValidator.h +++ b/runtimes/neurun/src/compiler/OperationValidator.h @@ -17,7 +17,7 @@ #ifndef __NEURUN_COMPILER_OPERATION_VALIDATOR_H__ #define __NEURUN_COMPILER_OPERATION_VALIDATOR_H__ -#include "graph/operation/NodeVisitor.h" +#include "model/operation/NodeVisitor.h" namespace neurun { @@ -35,15 +35,15 @@ namespace neurun namespace compiler { -class OperationValidator : public graph::operation::NodeVisitor +class OperationValidator : public model::operation::NodeVisitor { public: OperationValidator(const neurun::model::operand::Set &ctx) : _ctx{ctx} {} public: #define OP(InternalName, IsNnApi, NnApiName) \ - virtual void visit(const graph::operation::InternalName &) override; -#include "graph/operation/Op.lst" + virtual void visit(const model::operation::InternalName &) override; +#include "model/operation/Op.lst" #undef OP private: diff --git a/runtimes/neurun/src/compiler/PlanBuilder.cc b/runtimes/neurun/src/compiler/PlanBuilder.cc index 3958773..d934aa8 100644 --- a/runtimes/neurun/src/compiler/PlanBuilder.cc +++ b/runtimes/neurun/src/compiler/PlanBuilder.cc @@ -37,7 +37,7 @@ void PlanBuilder::finalize(const backend::TensorBuilderSet &tensor_builders) auto &operands = _plan.operands(); for (auto &tensor_builder : tensor_builders) { - tensor_builder->iterate([&](const graph::operand::Index &index) { + tensor_builder->iterate([&](const model::operand::Index &index) { auto object = tensor_builder->wrapTensor(index); operands.set(index, object); }); diff --git a/runtimes/neurun/src/compiler/SubTensorAnalyzer.cc b/runtimes/neurun/src/compiler/SubTensorAnalyzer.cc index 2a62854..0851b79 100644 --- a/runtimes/neurun/src/compiler/SubTensorAnalyzer.cc +++ b/runtimes/neurun/src/compiler/SubTensorAnalyzer.cc @@ -28,7 +28,7 @@ namespace neurun namespace compiler { -void SubTensorAnalyzer::visit(const graph::operation::ConcatNode &node) +void SubTensorAnalyzer::visit(const model::operation::ConcatNode &node) { // If operator is concat (or other operators related with subsumption), fill subsumption info // TODO: if one tensor is subset of many parents or model input diff --git a/runtimes/neurun/src/compiler/SubTensorAnalyzer.h b/runtimes/neurun/src/compiler/SubTensorAnalyzer.h index 41bd9e8..ddfd102 100644 --- a/runtimes/neurun/src/compiler/SubTensorAnalyzer.h +++ b/runtimes/neurun/src/compiler/SubTensorAnalyzer.h @@ -23,7 +23,7 @@ #ifndef __NEURUN_COMPILER_SUBTENSOR_ANALYZER_H__ #define __NEURUN_COMPILER_SUBTENSOR_ANALYZER_H__ -#include "graph/operation/NodeVisitor.h" +#include "model/operation/NodeVisitor.h" namespace neurun { @@ -44,7 +44,7 @@ namespace compiler /** * @brief Class to analyze tensor subsumption */ -class SubTensorAnalyzer : public graph::operation::NodeVisitor +class SubTensorAnalyzer : public model::operation::NodeVisitor { public: /** @@ -54,7 +54,7 @@ public: SubTensorAnalyzer(neurun::model::operand::Set &ctx) : _ctx{ctx} {} public: - virtual void visit(const graph::operation::ConcatNode &) override; + virtual void visit(const model::operation::ConcatNode &) override; private: neurun::model::operand::Set &_ctx; diff --git a/runtimes/neurun/src/dumper/dot/DotBuilder.h b/runtimes/neurun/src/dumper/dot/DotBuilder.h index 9b77c56..783e92b 100644 --- a/runtimes/neurun/src/dumper/dot/DotBuilder.h +++ b/runtimes/neurun/src/dumper/dot/DotBuilder.h @@ -19,16 +19,16 @@ #include -#include "graph/operation/Index.h" +#include "model/operation/Index.h" #include "model/operand/Index.h" -#include "graph/operation/Node.h" +#include "model/operation/Node.h" #include "model/operand/Object.h" #include "DotNodeInfo.h" #include "DotOperandInfo.h" -using Node = neurun::graph::operation::Node; +using Node = neurun::model::operation::Node; using Object = neurun::model::operand::Object; namespace neurun diff --git a/runtimes/neurun/src/dumper/dot/DotDumper.cc b/runtimes/neurun/src/dumper/dot/DotDumper.cc index 4e6b02a..f089e41 100644 --- a/runtimes/neurun/src/dumper/dot/DotDumper.cc +++ b/runtimes/neurun/src/dumper/dot/DotDumper.cc @@ -35,7 +35,7 @@ void DotDumper::dump(const std::string &tag, uint32_t option) auto &operations = _graph.operations(); auto &operands = _graph.operands(); - operations.iterate([&](const operation::Index &index, const operation::Node &node) { + operations.iterate([&](const model::operation::Index &index, const model::operation::Node &node) { neurun::dumper::dot::DotNodeInfo node_info(index, node); for (auto output : node.getOutputs()) diff --git a/runtimes/neurun/src/dumper/dot/DotNodeInfo.cc b/runtimes/neurun/src/dumper/dot/DotNodeInfo.cc index 431d714..6e66d87 100644 --- a/runtimes/neurun/src/dumper/dot/DotNodeInfo.cc +++ b/runtimes/neurun/src/dumper/dot/DotNodeInfo.cc @@ -32,8 +32,8 @@ const std::string DotNodeInfo::BG_COLOR_SCHEME = "pastel18"; // RED BLUE ORANGE YELLOW GREEN PUPLE CYAN PINK const std::string DotNodeInfo::BG_COLORS[8] = {"1", "2", "5", "6", "3", "4", "7", "8"}; -DotNodeInfo::DotNodeInfo(const neurun::graph::operation::Index &index, - const neurun::graph::operation::Node &node) +DotNodeInfo::DotNodeInfo(const neurun::model::operation::Index &index, + const neurun::model::operation::Node &node) : _index(index), _node(node) { const auto &lower_info = _node.lower_info(); diff --git a/runtimes/neurun/src/dumper/dot/DotNodeInfo.h b/runtimes/neurun/src/dumper/dot/DotNodeInfo.h index a87e311..ba50514 100644 --- a/runtimes/neurun/src/dumper/dot/DotNodeInfo.h +++ b/runtimes/neurun/src/dumper/dot/DotNodeInfo.h @@ -18,8 +18,8 @@ #define __NEURUN_DUMPER_DOT_DOT_NODE_INFO_H__ #include "IDotInfo.h" -#include "graph/operation/Node.h" -#include "graph/operation/Index.h" +#include "model/operation/Node.h" +#include "model/operation/Index.h" namespace neurun { @@ -36,8 +36,8 @@ public: static const std::string BG_COLORS[8]; public: - DotNodeInfo(const neurun::graph::operation::Index &index, - const neurun::graph::operation::Node &node); + DotNodeInfo(const neurun::model::operation::Index &index, + const neurun::model::operation::Node &node); public: virtual std::string index_str() const override; @@ -50,8 +50,8 @@ private: void addBackendLabel(); private: - neurun::graph::operation::Index _index; - const neurun::graph::operation::Node &_node; + neurun::model::operation::Index _index; + const neurun::model::operation::Node &_node; std::vector _labels; }; diff --git a/runtimes/neurun/src/frontend/model.cc b/runtimes/neurun/src/frontend/model.cc index e539b74..3aa2aa2 100644 --- a/runtimes/neurun/src/frontend/model.cc +++ b/runtimes/neurun/src/frontend/model.cc @@ -26,7 +26,7 @@ #include "graph/Graph.h" #include "frontend/wrapper/model.h" #include "frontend/wrapper/memory.h" -#include "graph/operation/Node.Include.h" +#include "model/operation/Node.Include.h" int ANeuralNetworksModel_create(ANeuralNetworksModel **model) { @@ -252,7 +252,7 @@ int ANeuralNetworksModel_addOperation(ANeuralNetworksModel *model, auto &graph = model->deref(); auto node_param = - neurun::graph::operation::Node::InitParam{inputCount, inputs, outputCount, outputs}; + neurun::model::operation::Node::InitParam{inputCount, inputs, outputCount, outputs}; try { @@ -268,7 +268,7 @@ int ANeuralNetworksModel_addOperation(ANeuralNetworksModel *model, if (inputCount == 7) { - using GraphNode = neurun::graph::operation::Conv2DNode; + using GraphNode = neurun::model::operation::Conv2DNode; graph.addOperation(nnfw::cpp14::make_unique(node_param)); } @@ -289,7 +289,7 @@ int ANeuralNetworksModel_addOperation(ANeuralNetworksModel *model, if (inputCount == 7) { - using GraphNode = neurun::graph::operation::MaxPool2DNode; + using GraphNode = neurun::model::operation::MaxPool2DNode; graph.addOperation(nnfw::cpp14::make_unique(node_param)); } @@ -310,7 +310,7 @@ int ANeuralNetworksModel_addOperation(ANeuralNetworksModel *model, if (inputCount == 7) { - using GraphNode = neurun::graph::operation::AvgPool2DNode; + using GraphNode = neurun::model::operation::AvgPool2DNode; graph.addOperation(nnfw::cpp14::make_unique(node_param)); } @@ -323,7 +323,7 @@ int ANeuralNetworksModel_addOperation(ANeuralNetworksModel *model, } case ANEURALNETWORKS_CONCATENATION: { - using GraphNode = neurun::graph::operation::ConcatNode; + using GraphNode = neurun::model::operation::ConcatNode; graph.addOperation(nnfw::cpp14::make_unique(node_param)); @@ -331,7 +331,7 @@ int ANeuralNetworksModel_addOperation(ANeuralNetworksModel *model, } case ANEURALNETWORKS_RESHAPE: { - using GraphNode = neurun::graph::operation::ReshapeNode; + using GraphNode = neurun::model::operation::ReshapeNode; graph.addOperation(nnfw::cpp14::make_unique(node_param)); @@ -339,7 +339,7 @@ int ANeuralNetworksModel_addOperation(ANeuralNetworksModel *model, } case ANEURALNETWORKS_FULLY_CONNECTED: { - using GraphNode = neurun::graph::operation::FullyConnectedNode; + using GraphNode = neurun::model::operation::FullyConnectedNode; graph.addOperation(nnfw::cpp14::make_unique(node_param)); @@ -347,7 +347,7 @@ int ANeuralNetworksModel_addOperation(ANeuralNetworksModel *model, } case ANEURALNETWORKS_SOFTMAX: { - using GraphNode = neurun::graph::operation::SoftmaxNode; + using GraphNode = neurun::model::operation::SoftmaxNode; graph.addOperation(nnfw::cpp14::make_unique(node_param)); diff --git a/runtimes/neurun/src/frontend/wrapper/model.cc b/runtimes/neurun/src/frontend/wrapper/model.cc index b731bb5..a7a9275 100644 --- a/runtimes/neurun/src/frontend/wrapper/model.cc +++ b/runtimes/neurun/src/frontend/wrapper/model.cc @@ -45,7 +45,7 @@ ResultCode ANeuralNetworksModel::finish() void ANeuralNetworksModel::fillOptionalOperand(void) { _model->operations().iterate( - [&](const ::neurun::graph::operation::Index &, ::neurun::graph::operation::Node &node) { + [&](const ::neurun::model::operation::Index &, ::neurun::model::operation::Node &node) { for (auto input : node.getInputs()) { // TODO fill default value for optional operands diff --git a/runtimes/neurun/src/frontend/wrapper/model.h b/runtimes/neurun/src/frontend/wrapper/model.h index c505f20..2386a64 100644 --- a/runtimes/neurun/src/frontend/wrapper/model.h +++ b/runtimes/neurun/src/frontend/wrapper/model.h @@ -31,7 +31,7 @@ public: ResultCode finish(); bool isFinished() { return !_model->isBuildingPhase(); } void release(std::shared_ptr &model) { model = _model; } - void setOptionalOperand(const neurun::graph::operand::Index idx) + void setOptionalOperand(const neurun::model::operand::Index idx) { _optional_operands.insert(idx); } @@ -41,7 +41,7 @@ private: private: std::shared_ptr _model; - std::unordered_set _optional_operands; + std::unordered_set _optional_operands; }; #endif // __MODEL_H__ diff --git a/runtimes/neurun/src/graph/Graph.cc b/runtimes/neurun/src/graph/Graph.cc index 6023529..33f30ea 100644 --- a/runtimes/neurun/src/graph/Graph.cc +++ b/runtimes/neurun/src/graph/Graph.cc @@ -28,7 +28,6 @@ #include "operand/Shape4DConvert.h" #include "compiler/BackendResolver.h" #include "backend/interface/IConfig.h" -#include "operation/PermuteNode.h" #include "pass/PermutationInsertionPass.h" #include "pass/PermutationEliminationPass.h" @@ -47,7 +46,7 @@ model::operand::Index Graph::addOperand(const model::operand::Shape &shape, return _model->operands.append(shape, type); } -operation::Index Graph::addOperation(std::unique_ptr &&node) +model::operation::Index Graph::addOperation(std::unique_ptr &&node) { assert(isBuildingPhase()); return _model->operations.append(std::move(node)); @@ -106,11 +105,11 @@ void Graph::lower(void) _backend_resolver = nnfw::cpp14::make_unique(_model->operands); - _model->operations.iterate([&](const operation::Index &, operation::Node &node) { + _model->operations.iterate([&](const model::operation::Index &, model::operation::Node &node) { auto backend = _backend_resolver->getBackend(typeid(node)); // Operation LowerInfo - node.lower_info(nnfw::cpp14::make_unique(backend)); + node.lower_info(nnfw::cpp14::make_unique(backend)); // LowerInfo for in/output operands for (auto operand : node.getInputs()) @@ -140,7 +139,7 @@ void Graph::lower(void) // Add DefBackend constants same as UseBackend // NOTE This assumes a constant operand is used by only one operation - _model->operations.iterate([&](const operation::Index &, operation::Node &node) { + _model->operations.iterate([&](const model::operation::Index &, model::operation::Node &node) { // LowerInfo for input operands for (auto operand : node.getInputs()) { @@ -172,7 +171,7 @@ void Graph::lower(void) return "{ " + str + "}"; }; - auto operation_index_to_string = [](const operation::IndexList &operations) { + auto operation_index_to_string = [](const model::operation::IndexList &operations) { std::string str; for (auto op : operations.list()) { @@ -239,19 +238,20 @@ std::unique_ptr Graph::linearize(void) void Graph::initializeUseDef() { - operations().iterate([&](const operation::Index &index, const operation::Node &node) -> void { - auto outputs = node.getOutputs(); - for (auto output : outputs) - { - operands().at(output).appendDef(index); - } + operations().iterate( + [&](const model::operation::Index &index, const model::operation::Node &node) -> void { + auto outputs = node.getOutputs(); + for (auto output : outputs) + { + operands().at(output).appendDef(index); + } - auto inputs = node.getInputs(); - for (auto input : inputs) - { - operands().at(input).appendUse(index); - } - }); + auto inputs = node.getInputs(); + for (auto input : inputs) + { + operands().at(input).appendUse(index); + } + }); } } // namespace graph @@ -277,7 +277,8 @@ template class Graph::PostDfsIterator; template void Graph::DefaultIterator::iterate(GraphRef graph, const IterFn &fn) const { - graph.operations().iterate([&](const operation::Index &, NodeRef node) -> void { fn(node); }); + graph.operations().iterate( + [&](const model::operation::Index &, NodeRef node) -> void { fn(node); }); } // @@ -289,12 +290,12 @@ void Graph::PostDfsIterator::iterate(GraphRef graph, const IterFn &fn) { assert(!graph.isBuildingPhase()); // Restrict iteration condition - std::unordered_map visited; + std::unordered_map visited; graph.operations().iterate( - [&](const operation::Index &index, NodeRef) { visited[index] = false; }); + [&](const model::operation::Index &index, NodeRef) { visited[index] = false; }); - std::function dfs_recursive = - [&](const operation::Index &index, NodeRef node) -> void { + std::function dfs_recursive = + [&](const model::operation::Index &index, NodeRef node) -> void { if (visited[index]) return; visited[index] = true; @@ -314,8 +315,9 @@ void Graph::PostDfsIterator::iterate(GraphRef graph, const IterFn &fn) graph.operations().iterate(dfs_recursive); // All of the operations(nodes) must have been visited. - assert(std::all_of(visited.begin(), visited.end(), - [](const std::pair &v) { return v.second; })); + assert(std::all_of( + visited.begin(), visited.end(), + [](const std::pair &v) { return v.second; })); } } // namespace graph diff --git a/runtimes/neurun/src/graph/Graph.h b/runtimes/neurun/src/graph/Graph.h index 520026d..6078793 100644 --- a/runtimes/neurun/src/graph/Graph.h +++ b/runtimes/neurun/src/graph/Graph.h @@ -19,7 +19,7 @@ #include -#include "graph/operation/Node.h" +#include "model/operation/Node.h" #include "graph/Model.h" namespace neurun @@ -59,8 +59,8 @@ public: { public: using GraphRef = typename std::conditional::type; - using NodeRef = - typename std::conditional::type; + using NodeRef = typename std::conditional::type; using IterFn = std::function; public: @@ -100,7 +100,7 @@ public: public: model::operand::Index addOperand(const model::operand::Shape &shape, const model::operand::TypeInfo &type); - operation::Index addOperation(std::unique_ptr &&node); + model::operation::Index addOperation(std::unique_ptr &&node); void setOperandValue(const model::operand::Index &ind, std::unique_ptr &&data); void addInput(const model::operand::Index &ind); @@ -126,8 +126,8 @@ public: { return _model->operands; } // TODO Remove this non-const accessor - const operation::Set &operations() const { return _model->operations; } - operation::Set &operations() { return _model->operations; } + const model::operation::Set &operations() const { return _model->operations; } + model::operation::Set &operations() { return _model->operations; } const compiler::BackendResolver *backend_resolver() const { return _backend_resolver.get(); } private: diff --git a/runtimes/neurun/src/graph/Model.h b/runtimes/neurun/src/graph/Model.h index 82a8ed8..20bb713 100644 --- a/runtimes/neurun/src/graph/Model.h +++ b/runtimes/neurun/src/graph/Model.h @@ -17,7 +17,7 @@ #ifndef __NEURUN_GRAPH_MODEL_H__ #define __NEURUN_GRAPH_MODEL_H__ -#include "graph/operation/Set.h" +#include "model/operation/Set.h" #include "model/operand/IndexSet.h" #include "model/operand/Set.h" @@ -28,7 +28,7 @@ namespace graph struct Model { - operation::Set operations; + model::operation::Set operations; model::operand::Set operands; model::operand::IndexSet inputs; model::operand::IndexSet outputs; diff --git a/runtimes/neurun/src/graph/dumper/Dumper.cc b/runtimes/neurun/src/graph/dumper/Dumper.cc index 1b885bd..efffc58 100644 --- a/runtimes/neurun/src/graph/dumper/Dumper.cc +++ b/runtimes/neurun/src/graph/dumper/Dumper.cc @@ -27,7 +27,7 @@ namespace graph namespace dumper { -using namespace neurun::graph::operation; +using namespace neurun::model::operation; void Dumper::visit(const Conv2DNode &node) { diff --git a/runtimes/neurun/src/graph/dumper/Dumper.h b/runtimes/neurun/src/graph/dumper/Dumper.h index fe5beb4..8c079a1 100644 --- a/runtimes/neurun/src/graph/dumper/Dumper.h +++ b/runtimes/neurun/src/graph/dumper/Dumper.h @@ -17,7 +17,7 @@ #ifndef __NEURUN_GRAPH_DUMPER_H__ #define __NEURUN_GRAPH_DUMPER_H__ -#include "graph/operation/NodeVisitor.h" +#include "model/operation/NodeVisitor.h" namespace neurun { @@ -26,21 +26,21 @@ namespace graph namespace dumper { -class Dumper : public graph::operation::NodeVisitor +class Dumper : public model::operation::NodeVisitor { public: Dumper() = default; public: - void visit(const graph::operation::Conv2DNode &node) override; - void visit(const graph::operation::MaxPool2DNode &node) override; - void visit(const graph::operation::AvgPool2DNode &node) override; - void visit(const graph::operation::ConcatNode &node) override; - void visit(const graph::operation::FullyConnectedNode &node) override; - void visit(const graph::operation::ReshapeNode &node) override; - void visit(const graph::operation::SoftmaxNode &node) override; - void visit(const graph::operation::PermuteNode &node) override; - void visit(const graph::operation::AddNode &node) override; + void visit(const model::operation::Conv2DNode &node) override; + void visit(const model::operation::MaxPool2DNode &node) override; + void visit(const model::operation::AvgPool2DNode &node) override; + void visit(const model::operation::ConcatNode &node) override; + void visit(const model::operation::FullyConnectedNode &node) override; + void visit(const model::operation::ReshapeNode &node) override; + void visit(const model::operation::SoftmaxNode &node) override; + void visit(const model::operation::PermuteNode &node) override; + void visit(const model::operation::AddNode &node) override; }; } // namespace dumper diff --git a/runtimes/neurun/src/graph/pass/OperationPass.cc b/runtimes/neurun/src/graph/pass/OperationPass.cc index 0164a1a..e71f791 100644 --- a/runtimes/neurun/src/graph/pass/OperationPass.cc +++ b/runtimes/neurun/src/graph/pass/OperationPass.cc @@ -27,8 +27,8 @@ namespace pass void OperationPass::run() { - _graph.operations().iterate( - [&](const operation::Index &index, operation::Node &node) { callback(index, node); }); + _graph.operations().iterate([&](const model::operation::Index &index, + model::operation::Node &node) { callback(index, node); }); } } // namespace pass diff --git a/runtimes/neurun/src/graph/pass/OperationPass.h b/runtimes/neurun/src/graph/pass/OperationPass.h index c05a0fc..e86f1aa 100644 --- a/runtimes/neurun/src/graph/pass/OperationPass.h +++ b/runtimes/neurun/src/graph/pass/OperationPass.h @@ -24,8 +24,8 @@ #include "Pass.h" -#include "graph/operation/Index.h" -#include "graph/operation/Node.h" +#include "model/operation/Index.h" +#include "model/operation/Node.h" namespace neurun { @@ -61,7 +61,7 @@ public: * @param i[in] Index of the operation node * @param n[in] The operation node */ - virtual void callback(const operation::Index &i, operation::Node &n) = 0; + virtual void callback(const model::operation::Index &i, model::operation::Node &n) = 0; }; } // namespace pass diff --git a/runtimes/neurun/src/graph/pass/PermutationInsertionPass.cc b/runtimes/neurun/src/graph/pass/PermutationInsertionPass.cc index 7aa9456..1f49c91 100644 --- a/runtimes/neurun/src/graph/pass/PermutationInsertionPass.cc +++ b/runtimes/neurun/src/graph/pass/PermutationInsertionPass.cc @@ -26,7 +26,7 @@ #include "backend/interface/IConfig.h" #include "util/logging.h" #include "cpp14/memory.h" -#include "graph/operation/PermuteNode.h" +#include "model/operation/PermuteNode.h" #include "graph/operand/Shape4DConvert.h" #include "compiler/BackendResolver.h" @@ -50,10 +50,10 @@ void PermutationInsertionPass::callback(const model::operand::Index &index, return; } - std::list permute_indexes; + std::list permute_indexes; // Build a map for all necessary type of operands - std::unordered_map backend_to_index; + std::unordered_map backend_to_index; { assert(operand_li->def_backends().size() == 1); for (auto backend : operand_li->def_backends()) @@ -76,7 +76,7 @@ void PermutationInsertionPass::callback(const model::operand::Index &index, // Update operations' input that uses this operand { - std::list remove_list; + std::list remove_list; auto uses = object.getUses(); for (auto use : uses.list()) @@ -113,8 +113,9 @@ void PermutationInsertionPass::callback(const model::operand::Index &index, } } -operation::Index PermutationInsertionPass::insertPermute(const model::operand::Index &operand_index, - const backend::Backend *backend) +model::operation::Index +PermutationInsertionPass::insertPermute(const model::operand::Index &operand_index, + const backend::Backend *backend) { assert(_graph.isLowered()); @@ -143,8 +144,8 @@ operation::Index PermutationInsertionPass::insertPermute(const model::operand::I // Insert permute operation to the graph auto insert_node = - nnfw::cpp14::make_unique(operand_index, out_operand_index); - insert_node->lower_info(nnfw::cpp14::make_unique( + nnfw::cpp14::make_unique(operand_index, out_operand_index); + insert_node->lower_info(nnfw::cpp14::make_unique( _graph.backend_resolver()->getDefaultBackend())); auto node_index = _graph.operations().append(std::move(insert_node)); diff --git a/runtimes/neurun/src/graph/pass/PermutationInsertionPass.h b/runtimes/neurun/src/graph/pass/PermutationInsertionPass.h index ed8862c..b2d417e 100644 --- a/runtimes/neurun/src/graph/pass/PermutationInsertionPass.h +++ b/runtimes/neurun/src/graph/pass/PermutationInsertionPass.h @@ -18,7 +18,7 @@ #define __NEURUN_GRAPH_PASS_PERMUTATION_INSERTION_PASS_H__ #include "OperandPass.h" -#include "model/operand/Object.h" //for operation::Index +#include "model/operand/Object.h" //for model::operation::Index namespace neurun { @@ -42,10 +42,10 @@ public: * @param operand_index is the target operand index for the insertion * @param backend is the output operand's backend type * - * @return operation::Index + * @return model::operation::Index */ - operation::Index insertPermute(const model::operand::Index &operand_index, - const backend::Backend *backend); + model::operation::Index insertPermute(const model::operand::Index &operand_index, + const backend::Backend *backend); private: }; diff --git a/runtimes/neurun/src/graph/verifier/Verifier.cc b/runtimes/neurun/src/graph/verifier/Verifier.cc index 3d68614..a5b53af 100644 --- a/runtimes/neurun/src/graph/verifier/Verifier.cc +++ b/runtimes/neurun/src/graph/verifier/Verifier.cc @@ -36,14 +36,15 @@ bool DAGChecker::verify(const Graph &graph) const auto &operations = graph.operations(); bool cyclic = false; - std::unordered_map visited; - operations.iterate([&](const graph::operation::Index &index, const operation::Node &) { + std::unordered_map visited; + operations.iterate([&](const model::operation::Index &index, const model::operation::Node &) { visited[index] = false; }); - std::unordered_map on_stack = visited; // Copy from visited + std::unordered_map on_stack = visited; // Copy from visited - std::function dfs_recursive = - [&](const operation::Index &index, const operation::Node &node) -> void { + std::function + dfs_recursive = + [&](const model::operation::Index &index, const model::operation::Node &node) -> void { if (on_stack[index]) cyclic = true; if (visited[index]) @@ -76,7 +77,7 @@ bool EdgeConsistencyChecker::verify(const Graph &graph) const { auto &operations = graph.operations(); uint32_t mismatches = 0; - operations.iterate([&](const operation::Index &index, const operation::Node &node) { + operations.iterate([&](const model::operation::Index &index, const model::operation::Node &node) { for (auto operand_index : node.getInputs()) { auto &operand = graph.operands().at(operand_index); diff --git a/runtimes/neurun/src/linear/Linear.cc b/runtimes/neurun/src/linear/Linear.cc index 29dff16..109d85b 100644 --- a/runtimes/neurun/src/linear/Linear.cc +++ b/runtimes/neurun/src/linear/Linear.cc @@ -43,12 +43,12 @@ Linear::Linear(const graph::Graph &graph) : _graph(graph) // 3. Reverse the order of nodes graph::Graph::PostDfsConstIterator().iterate( - graph, [&](const neurun::graph::operation::Node &node) { _operations.emplace_back(&node); }); + graph, [&](const neurun::model::operation::Node &node) { _operations.emplace_back(&node); }); std::reverse(std::begin(_operations), std::end(_operations)); } -void Linear::accept(graph::operation::NodeVisitor &&visitor) const +void Linear::accept(model::operation::NodeVisitor &&visitor) const { for (const auto op : _operations) { @@ -184,7 +184,7 @@ backend::TensorBuilderSet Linear::planTensors() return tensor_builders; } -void Linear::iterate(const std::function &fn) const +void Linear::iterate(const std::function &fn) const { for (const auto op : _operations) { diff --git a/runtimes/neurun/src/linear/Linear.h b/runtimes/neurun/src/linear/Linear.h index 42a314e..c65abfc 100644 --- a/runtimes/neurun/src/linear/Linear.h +++ b/runtimes/neurun/src/linear/Linear.h @@ -19,7 +19,7 @@ #include -#include "graph/operation/Node.h" +#include "model/operation/Node.h" #include "backend/interface/ITensorBuilder.h" namespace neurun @@ -55,16 +55,16 @@ public: Linear(const Linear &linear) = delete; public: - void accept(graph::operation::NodeVisitor &&visitor) const; + void accept(model::operation::NodeVisitor &&visitor) const; // TODO Should not return TensorBuilderSet backend::TensorBuilderSet planTensors(); - void iterate(const std::function &fn) const; + void iterate(const std::function &fn) const; private: const graph::Graph &_graph; - std::vector _operations; + std::vector _operations; }; } // namespace linear diff --git a/runtimes/neurun/src/model/operand/Object.cc b/runtimes/neurun/src/model/operand/Object.cc index f15cbd4..63cf29b 100644 --- a/runtimes/neurun/src/model/operand/Object.cc +++ b/runtimes/neurun/src/model/operand/Object.cc @@ -73,7 +73,7 @@ bool Object::setUsage(const OperandUsage usage) return true; } -void Object::appendUse(const ::neurun::graph::operation::Index &idx) +void Object::appendUse(const ::neurun::model::operation::Index &idx) { assert(_usage != OperandUsage::NOT_DEFINED); assert(!_uses.contains(idx)); @@ -81,7 +81,7 @@ void Object::appendUse(const ::neurun::graph::operation::Index &idx) _uses.append(idx); } -void Object::removeUse(const ::neurun::graph::operation::Index &idx) +void Object::removeUse(const ::neurun::model::operation::Index &idx) { assert(_usage != OperandUsage::NOT_DEFINED); assert(_uses.contains(idx)); @@ -89,7 +89,7 @@ void Object::removeUse(const ::neurun::graph::operation::Index &idx) _uses.remove(idx); } -void Object::appendDef(const ::neurun::graph::operation::Index &idx) +void Object::appendDef(const ::neurun::model::operation::Index &idx) { assert(_usage != OperandUsage::NOT_DEFINED && _usage != OperandUsage::CONSTANT); assert(_def.size() == 0); @@ -97,7 +97,7 @@ void Object::appendDef(const ::neurun::graph::operation::Index &idx) _def.append(idx); } -void Object::removeDef(const ::neurun::graph::operation::Index &idx) +void Object::removeDef(const ::neurun::model::operation::Index &idx) { assert(_usage != OperandUsage::NOT_DEFINED); assert(_def.contains(idx)); diff --git a/runtimes/neurun/src/model/operand/Object.h b/runtimes/neurun/src/model/operand/Object.h index 8079596..eb5f627 100644 --- a/runtimes/neurun/src/model/operand/Object.h +++ b/runtimes/neurun/src/model/operand/Object.h @@ -27,7 +27,7 @@ #include "TypeInfo.h" #include "graph/operand/LowerInfo.h" // TODO Remove this dependency #include "graph/operand/ParentInfo.h" // TODO Remove this dependency -#include "graph/operation/IndexList.h" +#include "model/operation/IndexList.h" namespace neurun { @@ -65,12 +65,12 @@ public: bool isModelInput(void) const { return _usage == OperandUsage::MODEL_INPUT; } OperandUsage getUsage() const { return _usage; } - const graph::operation::IndexList &getUses() const { return _uses; } - const graph::operation::IndexList &getDef() const { return _def; } - void appendUse(const graph::operation::Index &idx); - void removeUse(const graph::operation::Index &idx); - void appendDef(const graph::operation::Index &idx); - void removeDef(const graph::operation::Index &idx); + const operation::IndexList &getUses() const { return _uses; } + const operation::IndexList &getDef() const { return _def; } + void appendUse(const operation::Index &idx); + void removeUse(const operation::Index &idx); + void appendDef(const operation::Index &idx); + void removeDef(const operation::Index &idx); private: bool setUsage(OperandUsage usage); @@ -121,8 +121,8 @@ private: std::unique_ptr _data; OperandUsage _usage; - graph::operation::IndexList _uses; - graph::operation::IndexList _def; // size is 0 (constant) or 1 (from def operation) + operation::IndexList _uses; + operation::IndexList _def; // size is 0 (constant) or 1 (from def operation) std::unique_ptr _lower_info; std::unique_ptr _parent_info; diff --git a/runtimes/neurun/src/graph/operation/AddNode.cc b/runtimes/neurun/src/model/operation/AddNode.cc similarity index 87% rename from runtimes/neurun/src/graph/operation/AddNode.cc rename to runtimes/neurun/src/model/operation/AddNode.cc index eebffdd..0c9d4e0 100644 --- a/runtimes/neurun/src/graph/operation/AddNode.cc +++ b/runtimes/neurun/src/model/operation/AddNode.cc @@ -22,15 +22,15 @@ namespace neurun { -namespace graph +namespace model { namespace operation { void AddNode::accept(NodeVisitor &&v) const { v.visit(*this); } -AddNode::AddNode(const graph::operation::Node::InitParam &init_param) - : operation::Node{OperandConstraint::createExact(2u)} +AddNode::AddNode(const model::operation::Node::InitParam &init_param) + : model::operation::Node{OperandConstraint::createExact(2u)} { assert(init_param.input_count == 2); assert(init_param.output_count == 1); @@ -45,5 +45,5 @@ AddNode::AddNode(const graph::operation::Node::InitParam &init_param) } } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/AddNode.h b/runtimes/neurun/src/model/operation/AddNode.h similarity index 75% rename from runtimes/neurun/src/graph/operation/AddNode.h rename to runtimes/neurun/src/model/operation/AddNode.h index de732a5..533fb0a 100644 --- a/runtimes/neurun/src/graph/operation/AddNode.h +++ b/runtimes/neurun/src/model/operation/AddNode.h @@ -14,22 +14,22 @@ * limitations under the License. */ -#ifndef __NEURUN_GRAPH_OPERATION_ADD_H__ -#define __NEURUN_GRAPH_OPERATION_ADD_H__ +#ifndef __NEURUN_MODEL_OPERATION_ADD_NODE_H__ +#define __NEURUN_MODEL_OPERATION_ADD_NODE_H__ -#include "graph/operation/Node.h" +#include "model/operation/Node.h" namespace neurun { -namespace graph +namespace model { namespace operation { -class AddNode : public graph::operation::Node +class AddNode : public model::operation::Node { public: - AddNode(const graph::operation::Node::InitParam &init_param); + AddNode(const model::operation::Node::InitParam &init_param); enum Input { @@ -48,7 +48,7 @@ public: }; } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun -#endif // __NEURUN_GRAPH_OPERATION_ADD_H__ +#endif // __NEURUN_MODEL_OPERATION_ADD_H__ diff --git a/runtimes/neurun/src/graph/operation/AvgPool2DNode.cc b/runtimes/neurun/src/model/operation/AvgPool2DNode.cc similarity index 90% rename from runtimes/neurun/src/graph/operation/AvgPool2DNode.cc rename to runtimes/neurun/src/model/operation/AvgPool2DNode.cc index 4166d2b..8c688e6 100644 --- a/runtimes/neurun/src/graph/operation/AvgPool2DNode.cc +++ b/runtimes/neurun/src/model/operation/AvgPool2DNode.cc @@ -19,19 +19,18 @@ #include #include "NodeVisitor.h" -#include "LowerInfo.h" namespace neurun { -namespace graph +namespace model { namespace operation { void AvgPool2DNode::accept(NodeVisitor &&v) const { v.visit(*this); } -AvgPool2DNode::AvgPool2DNode(const graph::operation::Node::InitParam &init_param) - : operation::Node{OperandConstraint::createExact(1u)} +AvgPool2DNode::AvgPool2DNode(const model::operation::Node::InitParam &init_param) + : model::operation::Node{OperandConstraint::createExact(1u)} { assert(init_param.input_count == 7); assert(init_param.output_count == 1); @@ -59,5 +58,5 @@ AvgPool2DNode::AvgPool2DNode(const graph::operation::Node::InitParam &init_param } } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/AvgPool2DNode.h b/runtimes/neurun/src/model/operation/AvgPool2DNode.h similarity index 78% rename from runtimes/neurun/src/graph/operation/AvgPool2DNode.h rename to runtimes/neurun/src/model/operation/AvgPool2DNode.h index 2a4f4cb..e66e614 100644 --- a/runtimes/neurun/src/graph/operation/AvgPool2DNode.h +++ b/runtimes/neurun/src/model/operation/AvgPool2DNode.h @@ -14,24 +14,24 @@ * limitations under the License. */ -#ifndef __NEURUN_GRAPH_OPERATION_AVGPOOL2D_H__ -#define __NEURUN_GRAPH_OPERATION_AVGPOOL2D_H__ +#ifndef __NEURUN_MODEL_OPERATION_AVGPOOL2D_NODE_H__ +#define __NEURUN_MODEL_OPERATION_AVGPOOL2D_NODE_H__ #include -#include "graph/operation/Node.h" +#include "model/operation/Node.h" namespace neurun { -namespace graph +namespace model { namespace operation { -class AvgPool2DNode : public graph::operation::Node +class AvgPool2DNode : public model::operation::Node { public: - AvgPool2DNode(const graph::operation::Node::InitParam &init_param); + AvgPool2DNode(const model::operation::Node::InitParam &init_param); enum Input { @@ -62,7 +62,7 @@ private: }; } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun -#endif // __NEURUN_GRAPH_OPERATION_AVGPOOL2D_H__ +#endif // __NEURUN_MODEL_OPERATION_AVGPOOL2D_H__ diff --git a/runtimes/neurun/src/graph/operation/ConcatNode.cc b/runtimes/neurun/src/model/operation/ConcatNode.cc similarity index 88% rename from runtimes/neurun/src/graph/operation/ConcatNode.cc rename to runtimes/neurun/src/model/operation/ConcatNode.cc index 48f6306..23cfef2 100644 --- a/runtimes/neurun/src/graph/operation/ConcatNode.cc +++ b/runtimes/neurun/src/model/operation/ConcatNode.cc @@ -19,19 +19,18 @@ #include #include "NodeVisitor.h" -#include "LowerInfo.h" namespace neurun { -namespace graph +namespace model { namespace operation { void ConcatNode::accept(NodeVisitor &&v) const { v.visit(*this); } -ConcatNode::ConcatNode(const graph::operation::Node::InitParam &init_param) - : operation::Node{OperandConstraint::createAtLeast(2u)} +ConcatNode::ConcatNode(const model::operation::Node::InitParam &init_param) + : model::operation::Node{OperandConstraint::createAtLeast(2u)} { assert(init_param.input_count >= 2); // At least one one input tensor and axis assert(init_param.output_count == 1); @@ -56,5 +55,5 @@ ConcatNode::ConcatNode(const graph::operation::Node::InitParam &init_param) } } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/ConcatNode.h b/runtimes/neurun/src/model/operation/ConcatNode.h similarity index 76% rename from runtimes/neurun/src/graph/operation/ConcatNode.h rename to runtimes/neurun/src/model/operation/ConcatNode.h index f9ac208..b69ee2f 100644 --- a/runtimes/neurun/src/graph/operation/ConcatNode.h +++ b/runtimes/neurun/src/model/operation/ConcatNode.h @@ -14,24 +14,24 @@ * limitations under the License. */ -#ifndef __NEURUN_GRAPH_OPERATION_CONCAT_H__ -#define __NEURUN_GRAPH_OPERATION_CONCAT_H__ +#ifndef __NEURUN_MODEL_OPERATION_CONCAT_NODE_H__ +#define __NEURUN_MODEL_OPERATION_CONCAT_NODE_H__ #include -#include "graph/operation/Node.h" +#include "model/operation/Node.h" namespace neurun { -namespace graph +namespace model { namespace operation { -class ConcatNode : public graph::operation::Node +class ConcatNode : public model::operation::Node { public: - ConcatNode(const graph::operation::Node::InitParam &init_param); + ConcatNode(const model::operation::Node::InitParam &init_param); struct Param { @@ -50,7 +50,7 @@ private: }; } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun -#endif // __NEURUN_GRAPH_OPERATION_CONCAT_H__ +#endif // __NEURUN_MODEL_OPERATION_CONCAT_H__ diff --git a/runtimes/neurun/src/graph/operation/Conv2DNode.cc b/runtimes/neurun/src/model/operation/Conv2DNode.cc similarity index 90% rename from runtimes/neurun/src/graph/operation/Conv2DNode.cc rename to runtimes/neurun/src/model/operation/Conv2DNode.cc index 7e96253..7eb2b18 100644 --- a/runtimes/neurun/src/graph/operation/Conv2DNode.cc +++ b/runtimes/neurun/src/model/operation/Conv2DNode.cc @@ -19,19 +19,18 @@ #include #include "NodeVisitor.h" -#include "LowerInfo.h" namespace neurun { -namespace graph +namespace model { namespace operation { void Conv2DNode::accept(NodeVisitor &&v) const { v.visit(*this); } -Conv2DNode::Conv2DNode(const graph::operation::Node::InitParam &init_param) - : operation::Node{OperandConstraint::createExact(3u)} +Conv2DNode::Conv2DNode(const model::operation::Node::InitParam &init_param) + : model::operation::Node{OperandConstraint::createExact(3u)} { assert(init_param.input_count == 7 && init_param.output_count == 1); @@ -56,5 +55,5 @@ Conv2DNode::Conv2DNode(const graph::operation::Node::InitParam &init_param) } } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/Conv2DNode.h b/runtimes/neurun/src/model/operation/Conv2DNode.h similarity index 78% rename from runtimes/neurun/src/graph/operation/Conv2DNode.h rename to runtimes/neurun/src/model/operation/Conv2DNode.h index 3bb4cc4..34a95f0 100644 --- a/runtimes/neurun/src/graph/operation/Conv2DNode.h +++ b/runtimes/neurun/src/model/operation/Conv2DNode.h @@ -14,24 +14,24 @@ * limitations under the License. */ -#ifndef __NEURUN_GRAPH_OPERATION_CONV2D_H__ -#define __NEURUN_GRAPH_OPERATION_CONV2D_H__ +#ifndef __NEURUN_MODEL_OPERATION_CONV2D_NODE_H__ +#define __NEURUN_MODEL_OPERATION_CONV2D_NODE_H__ #include -#include "graph/operation/Node.h" +#include "model/operation/Node.h" namespace neurun { -namespace graph +namespace model { namespace operation { -class Conv2DNode : public graph::operation::Node +class Conv2DNode : public model::operation::Node { public: - Conv2DNode(const graph::operation::Node::InitParam &); + Conv2DNode(const model::operation::Node::InitParam &); enum Input { @@ -61,7 +61,7 @@ private: }; } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun -#endif // __NEURUN_GRAPH_OPERATION_CONV2D_H__ +#endif // __NEURUN_MODEL_OPERATION_CONV2D_NODE_H__ diff --git a/runtimes/neurun/src/graph/operation/FullyConnectedNode.cc b/runtimes/neurun/src/model/operation/FullyConnectedNode.cc similarity index 88% rename from runtimes/neurun/src/graph/operation/FullyConnectedNode.cc rename to runtimes/neurun/src/model/operation/FullyConnectedNode.cc index ba07917..0fde518 100644 --- a/runtimes/neurun/src/graph/operation/FullyConnectedNode.cc +++ b/runtimes/neurun/src/model/operation/FullyConnectedNode.cc @@ -19,19 +19,18 @@ #include #include "NodeVisitor.h" -#include "LowerInfo.h" namespace neurun { -namespace graph +namespace model { namespace operation { void FullyConnectedNode::accept(NodeVisitor &&v) const { v.visit(*this); } -FullyConnectedNode::FullyConnectedNode(const graph::operation::Node::InitParam &init_param) - : operation::Node{OperandConstraint::createExact(3u)} +FullyConnectedNode::FullyConnectedNode(const model::operation::Node::InitParam &init_param) + : model::operation::Node{OperandConstraint::createExact(3u)} { assert(init_param.input_count == 4 && init_param.output_count == 1); @@ -49,5 +48,5 @@ FullyConnectedNode::FullyConnectedNode(const graph::operation::Node::InitParam & } } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/FullyConnectedNode.h b/runtimes/neurun/src/model/operation/FullyConnectedNode.h similarity index 75% rename from runtimes/neurun/src/graph/operation/FullyConnectedNode.h rename to runtimes/neurun/src/model/operation/FullyConnectedNode.h index 73dc991..9820ddc 100644 --- a/runtimes/neurun/src/graph/operation/FullyConnectedNode.h +++ b/runtimes/neurun/src/model/operation/FullyConnectedNode.h @@ -14,24 +14,24 @@ * limitations under the License. */ -#ifndef __NEURUN_GRAPH_OPERATION_FULLYCONNECTED_H__ -#define __NEURUN_GRAPH_OPERATION_FULLYCONNECTED_H__ +#ifndef __NEURUN_MODEL_OPERATION_FULLYCONNECTED_NODE_H__ +#define __NEURUN_MODEL_OPERATION_FULLYCONNECTED_NODE_H__ #include -#include "graph/operation/Node.h" +#include "model/operation/Node.h" namespace neurun { -namespace graph +namespace model { namespace operation { -class FullyConnectedNode : public graph::operation::Node +class FullyConnectedNode : public model::operation::Node { public: - FullyConnectedNode(const graph::operation::Node::InitParam &init_param); + FullyConnectedNode(const model::operation::Node::InitParam &init_param); enum Input { @@ -57,7 +57,7 @@ private: }; } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun -#endif // __NEURUN_GRAPH_OPERATION_FULLYCONNECTED_H__ +#endif // __NEURUN_MODEL_OPERATION_FULLYCONNECTED_NODE_H__ diff --git a/runtimes/neurun/src/graph/operation/Index.h b/runtimes/neurun/src/model/operation/Index.h similarity index 83% rename from runtimes/neurun/src/graph/operation/Index.h rename to runtimes/neurun/src/model/operation/Index.h index 3902d03..e03dd74 100644 --- a/runtimes/neurun/src/graph/operation/Index.h +++ b/runtimes/neurun/src/model/operation/Index.h @@ -14,14 +14,14 @@ * limitations under the License. */ -#ifndef __NEURUN_GRAPH_OPERATION_INDEX_H__ -#define __NEURUN_GRAPH_OPERATION_INDEX_H__ +#ifndef __NEURUN_MODEL_OPERATION_INDEX_H__ +#define __NEURUN_MODEL_OPERATION_INDEX_H__ #include "graph/Index.h" namespace neurun { -namespace graph +namespace model { namespace operation { @@ -29,7 +29,7 @@ namespace operation using Index = ::neurun::graph::Index; } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun -#endif // __NEURUN_GRAPH_OPERATION_INDEX_H__ +#endif // __NEURUN_MODEL_OPERATION_INDEX_H__ diff --git a/runtimes/neurun/src/graph/operation/IndexList.cc b/runtimes/neurun/src/model/operation/IndexList.cc similarity index 90% rename from runtimes/neurun/src/graph/operation/IndexList.cc rename to runtimes/neurun/src/model/operation/IndexList.cc index cdc5997..e469870 100644 --- a/runtimes/neurun/src/graph/operation/IndexList.cc +++ b/runtimes/neurun/src/model/operation/IndexList.cc @@ -20,7 +20,7 @@ namespace neurun { -namespace graph +namespace model { namespace operation { @@ -30,11 +30,11 @@ IndexList::IndexList(std::initializer_list list) : _list(list) // DO NOTHING } -bool IndexList::contains(const ::neurun::graph::operation::Index &index) const +bool IndexList::contains(const ::neurun::model::operation::Index &index) const { return std::find(_list.begin(), _list.end(), index) != _list.end(); } } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/IndexList.h b/runtimes/neurun/src/model/operation/IndexList.h similarity index 87% rename from runtimes/neurun/src/graph/operation/IndexList.h rename to runtimes/neurun/src/model/operation/IndexList.h index cfac46a..c0af298 100644 --- a/runtimes/neurun/src/graph/operation/IndexList.h +++ b/runtimes/neurun/src/model/operation/IndexList.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __NEURUN_GRAPH_OPERATION_INDEX_LIST_H__ -#define __NEURUN_GRAPH_OPERATION_INDEX_LIST_H__ +#ifndef __NEURUN_MODEL_OPERATION_INDEX_LIST_H__ +#define __NEURUN_MODEL_OPERATION_INDEX_LIST_H__ #include #include @@ -24,7 +24,7 @@ namespace neurun { -namespace graph +namespace model { namespace operation { @@ -49,7 +49,7 @@ private: }; } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun -#endif // __NEURUN_GRAPH_OPERATION_INDEX_LIST_H__ +#endif // __NEURUN_MODEL_OPERATION_INDEX_LIST_H__ diff --git a/runtimes/neurun/src/graph/operation/MaxPool2DNode.cc b/runtimes/neurun/src/model/operation/MaxPool2DNode.cc similarity index 90% rename from runtimes/neurun/src/graph/operation/MaxPool2DNode.cc rename to runtimes/neurun/src/model/operation/MaxPool2DNode.cc index c4f949c..3d3686b 100644 --- a/runtimes/neurun/src/graph/operation/MaxPool2DNode.cc +++ b/runtimes/neurun/src/model/operation/MaxPool2DNode.cc @@ -19,19 +19,18 @@ #include #include "NodeVisitor.h" -#include "LowerInfo.h" namespace neurun { -namespace graph +namespace model { namespace operation { void MaxPool2DNode::accept(NodeVisitor &&v) const { v.visit(*this); } -MaxPool2DNode::MaxPool2DNode(const graph::operation::Node::InitParam &init_param) - : operation::Node{OperandConstraint::createExact(1u)} +MaxPool2DNode::MaxPool2DNode(const model::operation::Node::InitParam &init_param) + : model::operation::Node{OperandConstraint::createExact(1u)} { assert(init_param.input_count == 7); assert(init_param.output_count == 1); @@ -59,5 +58,5 @@ MaxPool2DNode::MaxPool2DNode(const graph::operation::Node::InitParam &init_param } } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/MaxPool2DNode.h b/runtimes/neurun/src/model/operation/MaxPool2DNode.h similarity index 78% rename from runtimes/neurun/src/graph/operation/MaxPool2DNode.h rename to runtimes/neurun/src/model/operation/MaxPool2DNode.h index 5e8e9f2..96d1210 100644 --- a/runtimes/neurun/src/graph/operation/MaxPool2DNode.h +++ b/runtimes/neurun/src/model/operation/MaxPool2DNode.h @@ -14,24 +14,24 @@ * limitations under the License. */ -#ifndef __NEURUN_GRAPH_OPERATION_MAXPOOL2D_H__ -#define __NEURUN_GRAPH_OPERATION_MAXPOOL2D_H__ +#ifndef __NEURUN_MODEL_OPERATION_MAXPOOL2D_NODE_H__ +#define __NEURUN_MODEL_OPERATION_MAXPOOL2D_NODE_H__ #include -#include "graph/operation/Node.h" +#include "model/operation/Node.h" namespace neurun { -namespace graph +namespace model { namespace operation { -class MaxPool2DNode : public graph::operation::Node +class MaxPool2DNode : public model::operation::Node { public: - MaxPool2DNode(const graph::operation::Node::InitParam &init_param); + MaxPool2DNode(const model::operation::Node::InitParam &init_param); enum Input { @@ -62,7 +62,7 @@ private: }; } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun -#endif // __NEURUN_GRAPH_OPERATION_MAXPOOL2D_H__ +#endif // __NEURUN_MODEL_OPERATION_MAXPOOL2D_NODE_H__ diff --git a/runtimes/neurun/src/graph/operation/Node.Include.h b/runtimes/neurun/src/model/operation/Node.Include.h similarity index 100% rename from runtimes/neurun/src/graph/operation/Node.Include.h rename to runtimes/neurun/src/model/operation/Node.Include.h diff --git a/runtimes/neurun/src/graph/operation/Node.cc b/runtimes/neurun/src/model/operation/Node.cc similarity index 84% rename from runtimes/neurun/src/graph/operation/Node.cc rename to runtimes/neurun/src/model/operation/Node.cc index 74b37c4..bac67ff 100644 --- a/runtimes/neurun/src/graph/operation/Node.cc +++ b/runtimes/neurun/src/model/operation/Node.cc @@ -18,11 +18,11 @@ #include -#include "LowerInfo.h" +#include "graph/operation/LowerInfo.h" namespace neurun { -namespace graph +namespace model { namespace operation { @@ -49,13 +49,13 @@ void Node::replaceOutput(const operand::Index &from, const operand::Index &to) _outputs.replace(from, to); } -void Node::lower_info(std::unique_ptr &&lower_info) +void Node::lower_info(std::unique_ptr &&lower_info) { _lower_info = std::move(lower_info); } -const LowerInfo *Node::lower_info() const { return _lower_info.get(); } +const graph::operation::LowerInfo *Node::lower_info() const { return _lower_info.get(); } } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/Node.h b/runtimes/neurun/src/model/operation/Node.h similarity index 76% rename from runtimes/neurun/src/graph/operation/Node.h rename to runtimes/neurun/src/model/operation/Node.h index c75f1f8..d4e3686 100644 --- a/runtimes/neurun/src/graph/operation/Node.h +++ b/runtimes/neurun/src/model/operation/Node.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __NEURUN_GRAPH_OPERATION_NODE_H__ -#define __NEURUN_GRAPH_OPERATION_NODE_H__ +#ifndef __NEURUN_MODEL_OPERATION_NODE_H__ +#define __NEURUN_MODEL_OPERATION_NODE_H__ #include @@ -23,29 +23,24 @@ #include "model/operand/IndexSet.h" #include "OperandConstraint.h" -// TODO Temporary aliases. -// These will be removed once the classes are moved to `model::operation`. namespace neurun { namespace graph { -namespace operand +namespace operation { -// using ::neurun::model::operand::Object; -using ::neurun::model::operand::Index; -using ::neurun::model::operand::IndexSet; -} // namespace operand +class LowerInfo; +} // namespace operation } // namespace graph } // namespace neurun namespace neurun { -namespace graph +namespace model { namespace operation { -class LowerInfo; struct NodeVisitor; class Node @@ -77,18 +72,18 @@ public: void setOutputs(const operand::IndexSet &indexes); public: - void lower_info(std::unique_ptr &&lower_info); - const LowerInfo *lower_info() const; + void lower_info(std::unique_ptr &&lower_info); + const graph::operation::LowerInfo *lower_info() const; private: operand::IndexSet _inputs; operand::IndexSet _outputs; OperandConstraint _input_constr; - std::unique_ptr _lower_info; + std::unique_ptr _lower_info; }; } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun -#endif // __NEURUN_GRAPH_OPERATION_NODE_H__ +#endif // __NEURUN_MODEL_OPERATION_NODE_H__ diff --git a/runtimes/neurun/src/graph/operation/NodeVisitor.h b/runtimes/neurun/src/model/operation/NodeVisitor.h similarity index 80% rename from runtimes/neurun/src/graph/operation/NodeVisitor.h rename to runtimes/neurun/src/model/operation/NodeVisitor.h index f57c04d..8420de9 100644 --- a/runtimes/neurun/src/graph/operation/NodeVisitor.h +++ b/runtimes/neurun/src/model/operation/NodeVisitor.h @@ -14,14 +14,14 @@ * limitations under the License. */ -#ifndef __NEURUN_GRAPH_OPERATION_NODE_VISITOR_H__ -#define __NEURUN_GRAPH_OPERATION_NODE_VISITOR_H__ +#ifndef __NEURUN_MODEL_OPERATION_NODE_VISITOR_H__ +#define __NEURUN_MODEL_OPERATION_NODE_VISITOR_H__ #include "Node.Include.h" namespace neurun { -namespace graph +namespace model { namespace operation { @@ -32,12 +32,12 @@ struct NodeVisitor #define OP(InternalName, IsNnApi, NnApiName) \ virtual void visit(const InternalName &) {} -#include "graph/operation/Op.lst" +#include "model/operation/Op.lst" #undef OP }; } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun -#endif // __NEURUN_GRAPH_OPERATION_NODE_VISITOR_H__ +#endif // __NEURUN_MODEL_OPERATION_NODE_VISITOR_H__ diff --git a/runtimes/neurun/src/graph/operation/Op.lst b/runtimes/neurun/src/model/operation/Op.lst similarity index 100% rename from runtimes/neurun/src/graph/operation/Op.lst rename to runtimes/neurun/src/model/operation/Op.lst diff --git a/runtimes/neurun/src/graph/operation/OperandConstraint.cc b/runtimes/neurun/src/model/operation/OperandConstraint.cc similarity index 95% rename from runtimes/neurun/src/graph/operation/OperandConstraint.cc rename to runtimes/neurun/src/model/operation/OperandConstraint.cc index 36a0fe5..5c69de9 100644 --- a/runtimes/neurun/src/graph/operation/OperandConstraint.cc +++ b/runtimes/neurun/src/model/operation/OperandConstraint.cc @@ -18,11 +18,11 @@ namespace neurun { -namespace graph +namespace model { namespace operation { } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/OperandConstraint.h b/runtimes/neurun/src/model/operation/OperandConstraint.h similarity index 88% rename from runtimes/neurun/src/graph/operation/OperandConstraint.h rename to runtimes/neurun/src/model/operation/OperandConstraint.h index 20231bb..d1cd8aa 100644 --- a/runtimes/neurun/src/graph/operation/OperandConstraint.h +++ b/runtimes/neurun/src/model/operation/OperandConstraint.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __NEURUN_GRAPH_OPERATION_OPERAND_CONSTRAINT_H__ -#define __NEURUN_GRAPH_OPERATION_OPERAND_CONSTRAINT_H__ +#ifndef __NEURUN_MODEL_OPERATION_OPERAND_CONSTRAINT_H__ +#define __NEURUN_MODEL_OPERATION_OPERAND_CONSTRAINT_H__ #include #include @@ -23,7 +23,7 @@ namespace neurun { -namespace graph +namespace model { namespace operation { @@ -55,7 +55,7 @@ private: }; } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun -#endif // __NEURUN_GRAPH_OPERATION_OPERAND_CONSTRAINT_H__ +#endif // __NEURUN_MODEL_OPERATION_OPERAND_CONSTRAINT_H__ diff --git a/runtimes/neurun/src/graph/operation/PermuteNode.cc b/runtimes/neurun/src/model/operation/PermuteNode.cc similarity index 90% rename from runtimes/neurun/src/graph/operation/PermuteNode.cc rename to runtimes/neurun/src/model/operation/PermuteNode.cc index a606e4d..0e711b0 100644 --- a/runtimes/neurun/src/graph/operation/PermuteNode.cc +++ b/runtimes/neurun/src/model/operation/PermuteNode.cc @@ -22,7 +22,7 @@ namespace neurun { -namespace graph +namespace model { namespace operation { @@ -30,12 +30,12 @@ namespace operation void PermuteNode::accept(NodeVisitor &&v) const { v.visit(*this); } PermuteNode::PermuteNode(const operand::Index &input, const operand::Index &output) - : operation::Node{OperandConstraint::createExact(1u)} + : model::operation::Node{OperandConstraint::createExact(1u)} { setInputs({input}); setOutputs({output}); } } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/PermuteNode.h b/runtimes/neurun/src/model/operation/PermuteNode.h similarity index 77% rename from runtimes/neurun/src/graph/operation/PermuteNode.h rename to runtimes/neurun/src/model/operation/PermuteNode.h index c496722..3c0aeef 100644 --- a/runtimes/neurun/src/graph/operation/PermuteNode.h +++ b/runtimes/neurun/src/model/operation/PermuteNode.h @@ -14,19 +14,19 @@ * limitations under the License. */ -#ifndef __NEURUN_GRAPH_OPERATION_PERMUTE_PERMUTE_H__ -#define __NEURUN_GRAPH_OPERATION_PERMUTE_PERMUTE_H__ +#ifndef __NEURUN_MODEL_OPERATION_PERMUTE_NODE_H__ +#define __NEURUN_MODEL_OPERATION_PERMUTE_NODE_H__ -#include "graph/operation/Node.h" +#include "model/operation/Node.h" namespace neurun { -namespace graph +namespace model { namespace operation { -class PermuteNode : public graph::operation::Node +class PermuteNode : public model::operation::Node { public: virtual void accept(NodeVisitor &&) const override; @@ -37,7 +37,7 @@ public: }; } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun -#endif // __NEURUN_GRAPH_OPERATION_PERMUTE_PERMUTE_H__ +#endif // __NEURUN_MODEL_OPERATION_PERMUTE_NODE_H__ diff --git a/runtimes/neurun/src/graph/operation/ReshapeNode.cc b/runtimes/neurun/src/model/operation/ReshapeNode.cc similarity index 88% rename from runtimes/neurun/src/graph/operation/ReshapeNode.cc rename to runtimes/neurun/src/model/operation/ReshapeNode.cc index 4bfaaa3..616b8cd 100644 --- a/runtimes/neurun/src/graph/operation/ReshapeNode.cc +++ b/runtimes/neurun/src/model/operation/ReshapeNode.cc @@ -19,19 +19,18 @@ #include #include "NodeVisitor.h" -#include "LowerInfo.h" namespace neurun { -namespace graph +namespace model { namespace operation { void ReshapeNode::accept(NodeVisitor &&v) const { v.visit(*this); } -ReshapeNode::ReshapeNode(const graph::operation::Node::InitParam &init_param) - : operation::Node{OperandConstraint::createExact(1u)} +ReshapeNode::ReshapeNode(const model::operation::Node::InitParam &init_param) + : model::operation::Node{OperandConstraint::createExact(1u)} { assert(init_param.input_count == 2 && init_param.output_count == 1); @@ -47,5 +46,5 @@ ReshapeNode::ReshapeNode(const graph::operation::Node::InitParam &init_param) } } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/ReshapeNode.h b/runtimes/neurun/src/model/operation/ReshapeNode.h similarity index 73% rename from runtimes/neurun/src/graph/operation/ReshapeNode.h rename to runtimes/neurun/src/model/operation/ReshapeNode.h index eb90a5a..1758e9e 100644 --- a/runtimes/neurun/src/graph/operation/ReshapeNode.h +++ b/runtimes/neurun/src/model/operation/ReshapeNode.h @@ -14,24 +14,24 @@ * limitations under the License. */ -#ifndef __NEURUN_GRAPH_OPERATION_RESHAPE_H__ -#define __NEURUN_GRAPH_OPERATION_RESHAPE_H__ +#ifndef __NEURUN_MODEL_OPERATION_RESHAPE_NODE_H__ +#define __NEURUN_MODEL_OPERATION_RESHAPE_NODE_H__ #include -#include "graph/operation/Node.h" +#include "model/operation/Node.h" namespace neurun { -namespace graph +namespace model { namespace operation { -class ReshapeNode : public graph::operation::Node +class ReshapeNode : public model::operation::Node { public: - ReshapeNode(const graph::operation::Node::InitParam &init_param); + ReshapeNode(const model::operation::Node::InitParam &init_param); enum Input { @@ -44,7 +44,7 @@ public: }; } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun -#endif // __NEURUN_GRAPH_OPERATION_RESHAPE_H__ +#endif // __NEURUN_MODEL_OPERATION_RESHAPE_NODE_H__ diff --git a/runtimes/neurun/src/graph/operation/Set.cc b/runtimes/neurun/src/model/operation/Set.cc similarity index 97% rename from runtimes/neurun/src/graph/operation/Set.cc rename to runtimes/neurun/src/model/operation/Set.cc index a1ddfa6..14bd4f5 100644 --- a/runtimes/neurun/src/graph/operation/Set.cc +++ b/runtimes/neurun/src/model/operation/Set.cc @@ -20,7 +20,7 @@ namespace neurun { -namespace graph +namespace model { namespace operation { @@ -63,5 +63,5 @@ void Set::iterate(const std::function &fn) } } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/Set.h b/runtimes/neurun/src/model/operation/Set.h similarity index 87% rename from runtimes/neurun/src/graph/operation/Set.h rename to runtimes/neurun/src/model/operation/Set.h index 60d4575..eebf91e 100644 --- a/runtimes/neurun/src/graph/operation/Set.h +++ b/runtimes/neurun/src/model/operation/Set.h @@ -14,19 +14,19 @@ * limitations under the License. */ -#ifndef __NEURUN_GRAPH_OPERATION_SET_H__ -#define __NEURUN_GRAPH_OPERATION_SET_H__ +#ifndef __NEURUN_MODEL_OPERATION_SET_H__ +#define __NEURUN_MODEL_OPERATION_SET_H__ #include -#include "graph/operation/Index.h" +#include "model/operation/Index.h" #include "Node.h" #include namespace neurun { -namespace graph +namespace model { namespace operation { @@ -57,7 +57,7 @@ private: }; } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun -#endif // __NEURUN_GRAPH_OPERATION_SET_H__ +#endif // __NEURUN_MODEL_OPERATION_SET_H__ diff --git a/runtimes/neurun/src/graph/operation/SoftmaxNode.cc b/runtimes/neurun/src/model/operation/SoftmaxNode.cc similarity index 87% rename from runtimes/neurun/src/graph/operation/SoftmaxNode.cc rename to runtimes/neurun/src/model/operation/SoftmaxNode.cc index 66aa333..d157aa4 100644 --- a/runtimes/neurun/src/graph/operation/SoftmaxNode.cc +++ b/runtimes/neurun/src/model/operation/SoftmaxNode.cc @@ -19,19 +19,18 @@ #include #include "NodeVisitor.h" -#include "LowerInfo.h" namespace neurun { -namespace graph +namespace model { namespace operation { void SoftmaxNode::accept(NodeVisitor &&v) const { v.visit(*this); } -SoftmaxNode::SoftmaxNode(const graph::operation::Node::InitParam &init_param) - : operation::Node{OperandConstraint::createExact(1u)} +SoftmaxNode::SoftmaxNode(const model::operation::Node::InitParam &init_param) + : model::operation::Node{OperandConstraint::createExact(1u)} { assert(init_param.input_count == 2 && init_param.output_count == 1); @@ -47,5 +46,5 @@ SoftmaxNode::SoftmaxNode(const graph::operation::Node::InitParam &init_param) } } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/SoftmaxNode.h b/runtimes/neurun/src/model/operation/SoftmaxNode.h similarity index 76% rename from runtimes/neurun/src/graph/operation/SoftmaxNode.h rename to runtimes/neurun/src/model/operation/SoftmaxNode.h index 0037648..4a5a72e 100644 --- a/runtimes/neurun/src/graph/operation/SoftmaxNode.h +++ b/runtimes/neurun/src/model/operation/SoftmaxNode.h @@ -14,24 +14,24 @@ * limitations under the License. */ -#ifndef __NEURUN_GRAPH_OPERATION_SOFTMAX_H__ -#define __NEURUN_GRAPH_OPERATION_SOFTMAX_H__ +#ifndef __NEURUN_MODEL_OPERATION_SOFTMAX_NODE_H__ +#define __NEURUN_MODEL_OPERATION_SOFTMAX_NODE_H__ #include -#include "graph/operation/Node.h" +#include "model/operation/Node.h" namespace neurun { -namespace graph +namespace model { namespace operation { -class SoftmaxNode : public graph::operation::Node +class SoftmaxNode : public model::operation::Node { public: - SoftmaxNode(const graph::operation::Node::InitParam &init_param); + SoftmaxNode(const model::operation::Node::InitParam &init_param); enum Input { INPUT = 0 @@ -54,7 +54,7 @@ private: }; } // namespace operation -} // namespace graph +} // namespace model } // namespace neurun -#endif // __NEURUN_GRAPH_OPERATION_SOFTMAX_H__ +#endif // __NEURUN_MODEL_OPERATION_SOFTMAX_NODE_H__ diff --git a/runtimes/neurun/src/util/config/Config.lst b/runtimes/neurun/src/util/config/Config.lst index 95cee51..9035a2d 100644 --- a/runtimes/neurun/src/util/config/Config.lst +++ b/runtimes/neurun/src/util/config/Config.lst @@ -28,6 +28,6 @@ CONFIG(OP_BACKEND_ALLOPS , std::string , "none") #define OP(InternalName, IsNnApi, NnApiName) \ CONFIG(OP_BACKEND_ ## NnApiName, std::string, "acl_cl") -#include "graph/operation/Op.lst" +#include "model/operation/Op.lst" #undef OP diff --git a/runtimes/neurun/test/graph/MockNode.h b/runtimes/neurun/test/graph/MockNode.h index fe6ef0a..46a6274 100644 --- a/runtimes/neurun/test/graph/MockNode.h +++ b/runtimes/neurun/test/graph/MockNode.h @@ -17,7 +17,7 @@ #ifndef __NEURUN_TEST_GRAPH_MOCK_NODE_H__ #define __NEURUN_TEST_GRAPH_MOCK_NODE_H__ -#include "graph/operation/Node.h" +#include "model/operation/Node.h" #include "model/operand/IndexSet.h" namespace neurun_test @@ -25,19 +25,19 @@ namespace neurun_test namespace graph { -class SimpleMockNode : public neurun::graph::operation::Node +class SimpleMockNode : public neurun::model::operation::Node { public: - SimpleMockNode(const neurun::graph::operand::IndexSet &inputs, - const neurun::graph::operand::IndexSet &outputs) - : neurun::graph::operation::Node{neurun::graph::operation::OperandConstraint::createAny()} + SimpleMockNode(const neurun::model::operand::IndexSet &inputs, + const neurun::model::operand::IndexSet &outputs) + : neurun::model::operation::Node{neurun::model::operation::OperandConstraint::createAny()} { setInputs(inputs); setOutputs(outputs); } public: - virtual void accept(neurun::graph::operation::NodeVisitor &&) const override {} + virtual void accept(neurun::model::operation::NodeVisitor &&) const override {} virtual std::string getName() const override { return "SimpleMockNode"; } }; diff --git a/runtimes/neurun/test/graph/operation/Set.cc b/runtimes/neurun/test/graph/operation/Set.cc index 9fee441..3560482 100644 --- a/runtimes/neurun/test/graph/operation/Set.cc +++ b/runtimes/neurun/test/graph/operation/Set.cc @@ -17,11 +17,11 @@ #include #include "../MockNode.h" -#include "graph/operation/Set.h" +#include "model/operation/Set.h" -using neurun::graph::operation::Set; -using neurun::graph::operation::Node; -using neurun::graph::operation::Index; +using neurun::model::operation::Set; +using neurun::model::operation::Node; +using neurun::model::operation::Index; TEST(graph_operation_Set, operation_test) { diff --git a/runtimes/neurun/test/graph/operation/SetIO.cc b/runtimes/neurun/test/graph/operation/SetIO.cc index 3710266..a475bdc 100644 --- a/runtimes/neurun/test/graph/operation/SetIO.cc +++ b/runtimes/neurun/test/graph/operation/SetIO.cc @@ -18,8 +18,8 @@ #include "graph/Graph.h" #include "cpp14/memory.h" -#include "graph/operation/Conv2DNode.h" -#include "graph/operation/ConcatNode.h" +#include "model/operation/Conv2DNode.h" +#include "model/operation/ConcatNode.h" #include "model/operand/Index.h" #include "model/operand/IndexSet.h" @@ -27,7 +27,7 @@ using Index = neurun::model::operand::IO::Index; using IndexSet = neurun::model::operand::IndexSet; -using GraphNodeInitParam = neurun::graph::operation::Node::InitParam; +using GraphNodeInitParam = neurun::model::operation::Node::InitParam; TEST(graph_operation_setIO, operation_setIO_conv) { @@ -45,7 +45,7 @@ TEST(graph_operation_setIO, operation_setIO_conv) } uint32_t outoperand = graph.addOperand(shape, type).asInt(); - using GraphNode = neurun::graph::operation::Conv2DNode; + using GraphNode = neurun::model::operation::Conv2DNode; auto conv = nnfw::cpp14::make_unique(GraphNodeInitParam{7, params.data(), 1, &outoperand}); @@ -71,7 +71,7 @@ TEST(graph_operation_setIO, operation_setIO_concat) } uint32_t outoperand = graph.addOperand(shape, type).asInt(); - using GraphNode = neurun::graph::operation::ConcatNode; + using GraphNode = neurun::model::operation::ConcatNode; auto concat = nnfw::cpp14::make_unique(GraphNodeInitParam{7, params.data(), 1, &outoperand}); diff --git a/runtimes/neurun/test/graph/verifier/Verifier.cc b/runtimes/neurun/test/graph/verifier/Verifier.cc index da0a3b4..a37b0ac 100644 --- a/runtimes/neurun/test/graph/verifier/Verifier.cc +++ b/runtimes/neurun/test/graph/verifier/Verifier.cc @@ -16,7 +16,7 @@ #include -#include "graph/operation/Node.h" +#include "model/operation/Node.h" #include "graph/Graph.h" #include "graph/verifier/Verifier.h" #include "cpp14/memory.h" -- 2.7.4