summaryrefslogtreecommitdiff
path: root/runtimes
diff options
context:
space:
mode:
author이상규/On-Device Lab(SR)/Principal Engineer/삼성전자 <sg5.lee@samsung.com>2019-04-05 07:05:38 +0900
committer박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>2019-04-05 07:05:38 +0900
commit30383c814bfbd93dddae6c9d2a759d1270c93fba (patch)
tree695136793c2163ccc759817e79d93869d322eb90 /runtimes
parentc694525ecd582706672888d5d5eb299ce42d619c (diff)
downloadnnfw-30383c814bfbd93dddae6c9d2a759d1270c93fba.tar.gz
nnfw-30383c814bfbd93dddae6c9d2a759d1270c93fba.tar.bz2
nnfw-30383c814bfbd93dddae6c9d2a759d1270c93fba.zip
[neurun] Garden and remove redundunt code from ExecManager Test (#4930)
- Merge duplicated calls into one model->operands.at(operand_activation).usage(Usage::CONSTANT); model->operands.at(operand_activation).usage(operand::Usage::CONSTANT); - Group the related statements by operand and operator Signed-off-by: Sanggyu Lee <sg5.lee@samsung.com>
Diffstat (limited to 'runtimes')
-rw-r--r--runtimes/neurun/test/interp/ExecManager.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/runtimes/neurun/test/interp/ExecManager.cc b/runtimes/neurun/test/interp/ExecManager.cc
index ac2b40629..05388810a 100644
--- a/runtimes/neurun/test/interp/ExecManager.cc
+++ b/runtimes/neurun/test/interp/ExecManager.cc
@@ -45,6 +45,8 @@ protected:
// activation: none (constant)
std::unique_ptr<neurun::model::Model> model = nnfw::cpp14::make_unique<neurun::model::Model>();
+ // Add operands
+
operand::Shape shape{1, 2, 2, 1};
operand::TypeInfo type{DataType::INT32};
operand::Shape shape_scalar(0);
@@ -52,29 +54,33 @@ protected:
auto operand_lhs = model->operands.append(shape, type);
auto operand_rhs = model->operands.append(shape, type);
- auto input_set = operand::IndexSet{operand_lhs, operand_rhs};
auto operand_activation = model->operands.append(shape_scalar, type_scalar);
model->operands.at(operand_activation).usage(Usage::CONSTANT);
- operation::AddNode::Param param;
- param.activation_index = operand_activation;
- model->operands.at(operand_activation).usage(operand::Usage::CONSTANT);
model->operands.at(operand_activation)
.data(nnfw::cpp14::make_unique<operand::CachedData>(
reinterpret_cast<const uint8_t *>(&_activation_value), 4));
auto operand_result = model->operands.append(shape, type);
- auto output_set = operand::IndexSet{operand_result};
- model->operands.at(operand_result).usage(Usage::OPERATION_OUTPUT);
+ // Add operations
+
+ operation::AddNode::Param param;
+ param.activation_index = operand_activation;
+ auto input_set = operand::IndexSet{operand_lhs, operand_rhs};
+ auto output_set = operand::IndexSet{operand_result};
model->operations.append(
nnfw::cpp14::make_unique<operation::AddNode>(input_set, output_set, param));
+ // Identify model inputs and outputs
+
model->operands.at(operand_lhs).usage(Usage::MODEL_INPUT);
- model->operands.at(operand_rhs).usage(Usage::MODEL_INPUT);
model->inputs.append(operand_lhs);
+ model->operands.at(operand_rhs).usage(Usage::MODEL_INPUT);
model->inputs.append(operand_rhs);
+ model->operands.at(operand_result).usage(Usage::OPERATION_OUTPUT);
model->outputs.append(operand_result);
+
_graph = nnfw::cpp14::make_unique<::neurun::graph::Graph>(std::move(model));
_graph->finishBuilding();