diff options
Diffstat (limited to 'runtimes/neurun/test/graph/operand/UseDef.cc')
-rw-r--r-- | runtimes/neurun/test/graph/operand/UseDef.cc | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/runtimes/neurun/test/graph/operand/UseDef.cc b/runtimes/neurun/test/graph/operand/UseDef.cc index e3792f746..3afd6daa8 100644 --- a/runtimes/neurun/test/graph/operand/UseDef.cc +++ b/runtimes/neurun/test/graph/operand/UseDef.cc @@ -20,56 +20,52 @@ #include "graph/verifier/Verifier.h" #include "cpp14/memory.h" #include "../MockNode.h" +#include "model/Model.h" #include <typeindex> namespace { -using IndexSet = neurun::model::operand::IndexSet; +using IndexSet = neurun::model::OperandIndexSequence; using MockNode = neurun_test::graph::SimpleMockNode; } // namespace anonymous TEST(graph_operand_usedef, usedef_test) { - neurun::graph::Graph graph; + std::unique_ptr<neurun::model::Model> model = nnfw::cpp14::make_unique<neurun::model::Model>(); neurun::graph::verifier::DAGChecker verifier; - neurun::model::operand::Shape shape{1u}; - neurun::model::operand::TypeInfo type{ANEURALNETWORKS_TENSOR_INT32, 0, 0}; - shape.dim(0) = 3; + neurun::model::Shape shape(3); + neurun::model::TypeInfo type{neurun::model::DataType::INT32}; // Model Input/Output - auto input_operand = graph.addOperand(shape, type); - auto output_operand = graph.addOperand(shape, type); + auto input_operand = model->operands.emplace(shape, type); + auto output_operand = model->operands.emplace(shape, type); - graph.addInput(input_operand); - graph.operands().at(input_operand).setAsModelInput(); - graph.addOutput(output_operand); - graph.operands().at(output_operand).setAsOperationOutput(); + model->inputs.append(input_operand); + model->outputs.append(output_operand); // MockNode1 - auto operand_index1 = graph.addOperand(shape, type); - graph.operands().at(operand_index1).setAsOperationOutput(); - auto mocknode_index1 = graph.addOperation( + auto operand_index1 = model->operands.emplace(shape, type); + auto mocknode_index1 = model->operations.push( nnfw::cpp14::make_unique<MockNode>(IndexSet{input_operand}, IndexSet{operand_index1})); // MockNode2 - auto operand_index2 = graph.addOperand(shape, type); - graph.operands().at(operand_index2).setAsOperationOutput(); - auto mocknode_index2 = graph.addOperation( + auto operand_index2 = model->operands.emplace(shape, type); + auto mocknode_index2 = model->operations.push( nnfw::cpp14::make_unique<MockNode>(IndexSet{input_operand}, IndexSet{operand_index2})); // MockNode3(two input) - auto multiinput_index = graph.addOperation(nnfw::cpp14::make_unique<MockNode>( + auto multiinput_index = model->operations.push(nnfw::cpp14::make_unique<MockNode>( IndexSet{operand_index1, operand_index2}, IndexSet{output_operand})); + neurun::graph::Graph graph{std::move(model)}; graph.finishBuilding(); ASSERT_EQ(verifier.verify(graph), true); - const auto &operations = graph.operations(); // Check def ASSERT_EQ(graph.operands().at(operand_index1).getDef().contains(mocknode_index1), true); ASSERT_EQ(graph.operands().at(operand_index2).getDef().contains(mocknode_index2), true); |