diff options
Diffstat (limited to 'runtimes/neurun/test')
-rw-r--r-- | runtimes/neurun/test/backend/cpu/MemoryPlanner.cc | 127 | ||||
-rw-r--r-- | runtimes/neurun/test/graph/Graph.cc | 52 | ||||
-rw-r--r-- | runtimes/neurun/test/graph/Index.cc | 34 | ||||
-rw-r--r-- | runtimes/neurun/test/graph/MockNode.h | 47 | ||||
-rw-r--r-- | runtimes/neurun/test/graph/operand/IndexSet.cc | 52 | ||||
-rw-r--r-- | runtimes/neurun/test/graph/operand/LayoutSet.cc | 43 | ||||
-rw-r--r-- | runtimes/neurun/test/graph/operand/Set.cc | 48 | ||||
-rw-r--r-- | runtimes/neurun/test/graph/operand/UseDef.cc | 91 | ||||
-rw-r--r-- | runtimes/neurun/test/graph/operation/Set.cc | 34 | ||||
-rw-r--r-- | runtimes/neurun/test/graph/operation/SetIO.cc | 88 | ||||
-rw-r--r-- | runtimes/neurun/test/graph/verifier/Verifier.cc | 51 | ||||
-rw-r--r-- | runtimes/neurun/test/model.cc | 25 |
12 files changed, 0 insertions, 692 deletions
diff --git a/runtimes/neurun/test/backend/cpu/MemoryPlanner.cc b/runtimes/neurun/test/backend/cpu/MemoryPlanner.cc deleted file mode 100644 index 04f2e5da4..000000000 --- a/runtimes/neurun/test/backend/cpu/MemoryPlanner.cc +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <gtest/gtest.h> - -#include "backend/cpu/MemoryPlanner.h" -#include "model/operand/Index.h" - -TEST(Allocator, allocate_test) -{ - ::neurun::backend::cpu::Allocator allocator(1024); - ASSERT_NE(allocator.base(), nullptr); -} - -TEST(BumpPlanner, claim_test) -{ - ::neurun::backend::cpu::BumpPlanner planner; - - auto claim = [&planner](uint32_t index, size_t size, uint32_t expected_offset) { - ::neurun::model::operand::Index mem_idx(index); - planner.claim(mem_idx, size); - auto mem_blk = planner.memory_plans()[mem_idx]; - ASSERT_EQ(mem_blk.offset, expected_offset); - ASSERT_EQ(mem_blk.size, size); - }; - - claim(0, 10, 0); - claim(1, 20, 10); - claim(2, 30, 30); -} - -TEST(FirstFitPlanner, claim_release_test) -{ - ::neurun::backend::cpu::FirstFitPlanner planner; - - auto claim = [&planner](uint32_t index, size_t size, uint32_t expected_offset) { - ::neurun::model::operand::Index mem_idx(index); - planner.claim(mem_idx, size); - auto mem_blk = planner.memory_plans()[mem_idx]; - ASSERT_EQ(mem_blk.offset, expected_offset); - ASSERT_EQ(mem_blk.size, size); - }; - - auto release = [&planner](uint32_t index) { - ::neurun::model::operand::Index mem_idx(index); - planner.release(mem_idx); - }; - - // 0 CLAIM - 10 - claim(0, 10, 0); - - // 1 CLAIM - 20 - claim(1, 20, 10); - - // 2 CLAIM - 30 - claim(2, 30, 30); - - // 0 RELEASE - 10 - release(0); - - // 3 CLAIM - 20 - claim(3, 20, 60); - - // 4 CLAIM - 5 - claim(4, 5, 0); - - // 5 CLAIM - 10 - claim(5, 10, 80); - - // 6 CLAIM - 5 - claim(6, 5, 5); - - // 2 RELEASE - 30 - release(2); - - // 7 CLAIM - 35 - claim(7, 35, 90); - - // 8 CLAIM - 10 - claim(8, 10, 30); - - // 4 RELEASE - 5 - release(4); - - // 9 CLAIM - 10 - claim(9, 10, 40); - - // 10 CLAIM - 10 - claim(10, 10, 50); - - // 6 RELEASE - release(6); - - // 1 RELEASE - release(1); - - // 8 RELEASE - release(8); - - // 9 RELEASE - release(9); - - // 10 RELEASE - release(10); - - // 3 RELEASE - release(3); - - // 5 RELEASE - release(5); - - // 7 RELEASE - release(7); -} diff --git a/runtimes/neurun/test/graph/Graph.cc b/runtimes/neurun/test/graph/Graph.cc deleted file mode 100644 index e6db3fe49..000000000 --- a/runtimes/neurun/test/graph/Graph.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <gtest/gtest.h> - -#include "graph/Graph.h" - -TEST(Graph, inputs_and_outputs) -{ - ::neurun::graph::Graph graph; - - ::neurun::model::operand::Index index0{0u}; - ::neurun::model::operand::Index index1{1u}; - - graph.addInput({index0}); - graph.addInput({index1}); - - ::neurun::model::operand::Index index10{10u}; - ::neurun::model::operand::Index index11{11u}; - ::neurun::model::operand::Index index12{12u}; - - graph.addOutput({index10}); - graph.addOutput({index11}); - graph.addOutput({index12}); - - ASSERT_EQ(graph.getInputs().size(), 2); - ASSERT_EQ(graph.getOutputs().size(), 3); - - ::neurun::model::operand::IO::Index io_index0{0}; - ::neurun::model::operand::IO::Index io_index1{1}; - ::neurun::model::operand::IO::Index io_index2{2}; - - ASSERT_EQ(graph.getInputs().at(io_index0), 0); - ASSERT_EQ(graph.getInputs().at(io_index1), 1); - - ASSERT_EQ(graph.getOutputs().at(io_index0), 10); - ASSERT_EQ(graph.getOutputs().at(io_index1), 11); - ASSERT_EQ(graph.getOutputs().at(io_index2), 12); -} diff --git a/runtimes/neurun/test/graph/Index.cc b/runtimes/neurun/test/graph/Index.cc deleted file mode 100644 index c605cc4aa..000000000 --- a/runtimes/neurun/test/graph/Index.cc +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <gtest/gtest.h> - -#include "graph/Index.h" - -using Index = ::neurun::graph::Index<uint32_t, struct TestTag>; - -TEST(Index, index_test) -{ - Index idx1{1u}; - Index idx2{2u}; - Index idx3{idx1}; - - ASSERT_EQ(idx1, 1); - ASSERT_EQ(idx1, 1u); - ASSERT_EQ(idx1.value(), 1u); - ASSERT_NE(idx1, idx2); - ASSERT_EQ(idx1, idx3); -} diff --git a/runtimes/neurun/test/graph/MockNode.h b/runtimes/neurun/test/graph/MockNode.h deleted file mode 100644 index 46a6274dd..000000000 --- a/runtimes/neurun/test/graph/MockNode.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __NEURUN_TEST_GRAPH_MOCK_NODE_H__ -#define __NEURUN_TEST_GRAPH_MOCK_NODE_H__ - -#include "model/operation/Node.h" -#include "model/operand/IndexSet.h" - -namespace neurun_test -{ -namespace graph -{ - -class SimpleMockNode : public neurun::model::operation::Node -{ -public: - 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::model::operation::NodeVisitor &&) const override {} - virtual std::string getName() const override { return "SimpleMockNode"; } -}; - -} // namespace graph -} // namespace neurun_test - -#endif // __NEURUN_TEST_GRAPH_MOCK_NODE_H__ diff --git a/runtimes/neurun/test/graph/operand/IndexSet.cc b/runtimes/neurun/test/graph/operand/IndexSet.cc deleted file mode 100644 index de4768cda..000000000 --- a/runtimes/neurun/test/graph/operand/IndexSet.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <gtest/gtest.h> - -#include "model/operand/IndexSet.h" - -using neurun::model::operand::Index; -using neurun::model::operand::IndexSet; - -TEST(graph_operand_IndexSet, append) -{ - IndexSet iset{0, 2, 4, 8}; - - ASSERT_EQ(iset.size(), 4); - - iset.append(Index{10}); - - ASSERT_EQ(iset.size(), 5); - - neurun::model::operand::IO::Index index1{1}; - neurun::model::operand::IO::Index index2{4}; - - ASSERT_EQ(iset.at(index1), 2); - ASSERT_EQ(iset.at(index2), 10); - - ASSERT_TRUE(iset.contains(Index{2})); - ASSERT_TRUE(iset.contains(Index{10})); - ASSERT_FALSE(iset.contains(Index{11})); -} - -TEST(graph_operand_IndexSet, replace) -{ - IndexSet iset{0, 1, 2, 3}; - - iset.replace(Index{1}, Index{9}); - ASSERT_FALSE(iset.contains(Index{1})); - ASSERT_TRUE(iset.contains(Index{9})); -} diff --git a/runtimes/neurun/test/graph/operand/LayoutSet.cc b/runtimes/neurun/test/graph/operand/LayoutSet.cc deleted file mode 100644 index f83e76e30..000000000 --- a/runtimes/neurun/test/graph/operand/LayoutSet.cc +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <gtest/gtest.h> - -#include "graph/operand/LayoutSet.h" - -using neurun::graph::operand::Layout; -using neurun::graph::operand::LayoutSet; - -TEST(graph_operand_LayoutSet, layout_set_operators) -{ - LayoutSet set1{Layout::NCHW}; - LayoutSet set2{Layout::NHWC}; - LayoutSet set3 = set1 | set2; - - ASSERT_EQ(set3.size(), 2); - - ASSERT_EQ((set3 - set1).size(), 1); - ASSERT_EQ((set3 - set1).contains(Layout::NHWC), true); - ASSERT_EQ((set3 - set2).size(), 1); - ASSERT_EQ((set3 - set2).contains(Layout::NCHW), true); - ASSERT_EQ((set3 - set3).size(), 0); - - ASSERT_EQ((set3 & set1).size(), 1); - ASSERT_EQ((set3 & set1).contains(Layout::NCHW), true); - ASSERT_EQ((set3 & set2).size(), 1); - ASSERT_EQ((set3 & set2).contains(Layout::NHWC), true); - ASSERT_EQ((set1 & set2).size(), 0); -} diff --git a/runtimes/neurun/test/graph/operand/Set.cc b/runtimes/neurun/test/graph/operand/Set.cc deleted file mode 100644 index 00b6a7222..000000000 --- a/runtimes/neurun/test/graph/operand/Set.cc +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <gtest/gtest.h> - -#include "model/operand/Set.h" - -TEST(graph_operand_Set, set_test) -{ - neurun::model::operand::Set set; - - ::neurun::model::operand::Shape shape0{3}; - shape0.dim(0) = 1; - shape0.dim(1) = 2; - shape0.dim(2) = 3; - - ::neurun::model::operand::Shape shape1{4}; - shape1.dim(0) = 10; - shape1.dim(1) = 20; - shape1.dim(2) = 30; - shape1.dim(3) = 40; - - ::neurun::model::operand::TypeInfo type{ANEURALNETWORKS_TENSOR_INT32, 0, 0}; - - set.append(shape0, type); - set.append(shape1, type); - - ASSERT_EQ(set.exist(neurun::model::operand::Index{0u}), true); - ASSERT_EQ(set.exist(neurun::model::operand::Index{1u}), true); - ASSERT_EQ(set.exist(neurun::model::operand::Index{2u}), false); - - ASSERT_EQ(set.at(neurun::model::operand::Index{0u}).shape().dim(0), 1); - ASSERT_EQ(set.at(neurun::model::operand::Index{0u}).shape().dim(1), 2); - ASSERT_EQ(set.at(neurun::model::operand::Index{0u}).shape().dim(2), 3); -} diff --git a/runtimes/neurun/test/graph/operand/UseDef.cc b/runtimes/neurun/test/graph/operand/UseDef.cc deleted file mode 100644 index e3792f746..000000000 --- a/runtimes/neurun/test/graph/operand/UseDef.cc +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <gtest/gtest.h> - -#include "graph/Graph.h" -#include "graph/verifier/Verifier.h" -#include "cpp14/memory.h" -#include "../MockNode.h" - -#include <typeindex> - -namespace -{ - -using IndexSet = neurun::model::operand::IndexSet; -using MockNode = neurun_test::graph::SimpleMockNode; - -} // namespace anonymous - -TEST(graph_operand_usedef, usedef_test) -{ - neurun::graph::Graph graph; - 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; - - // Model Input/Output - auto input_operand = graph.addOperand(shape, type); - auto output_operand = graph.addOperand(shape, type); - - graph.addInput(input_operand); - graph.operands().at(input_operand).setAsModelInput(); - graph.addOutput(output_operand); - graph.operands().at(output_operand).setAsOperationOutput(); - - // MockNode1 - auto operand_index1 = graph.addOperand(shape, type); - graph.operands().at(operand_index1).setAsOperationOutput(); - auto mocknode_index1 = graph.addOperation( - 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( - nnfw::cpp14::make_unique<MockNode>(IndexSet{input_operand}, IndexSet{operand_index2})); - - // MockNode3(two input) - auto multiinput_index = graph.addOperation(nnfw::cpp14::make_unique<MockNode>( - IndexSet{operand_index1, operand_index2}, IndexSet{output_operand})); - - 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); - ASSERT_EQ(graph.operands().at(output_operand).getDef().contains(multiinput_index), true); - - ASSERT_EQ(graph.operands().at(operand_index1).getDef().contains(mocknode_index2), false); - ASSERT_EQ(graph.operands().at(operand_index1).getDef().contains(multiinput_index), false); - - // Check use - ASSERT_EQ(graph.operands().at(input_operand).getUses().contains(mocknode_index1), true); - ASSERT_EQ(graph.operands().at(input_operand).getUses().contains(mocknode_index2), true); - ASSERT_EQ(graph.operands().at(input_operand).getUses().contains(multiinput_index), false); - ASSERT_EQ(graph.operands().at(operand_index1).getUses().contains(multiinput_index), true); - ASSERT_EQ(graph.operands().at(operand_index2).getUses().contains(multiinput_index), true); - - ASSERT_EQ(graph.operands().at(input_operand).getUses().size(), 2); - ASSERT_EQ(graph.operands().at(operand_index1).getUses().size(), 1); - ASSERT_EQ(graph.operands().at(output_operand).getUses().size(), 0); -} diff --git a/runtimes/neurun/test/graph/operation/Set.cc b/runtimes/neurun/test/graph/operation/Set.cc deleted file mode 100644 index 3560482ee..000000000 --- a/runtimes/neurun/test/graph/operation/Set.cc +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <gtest/gtest.h> - -#include "../MockNode.h" -#include "model/operation/Set.h" - -using neurun::model::operation::Set; -using neurun::model::operation::Node; -using neurun::model::operation::Index; - -TEST(graph_operation_Set, operation_test) -{ - Set set; - set.append( - std::unique_ptr<Node>(new neurun_test::graph::SimpleMockNode({1, 2, 3, 4}, {5, 6, 7}))); - Index idx{0u}; - ASSERT_EQ(set.at(idx).getInputs().size(), 4); - ASSERT_EQ(set.at(idx).getOutputs().size(), 3); -} diff --git a/runtimes/neurun/test/graph/operation/SetIO.cc b/runtimes/neurun/test/graph/operation/SetIO.cc deleted file mode 100644 index a475bdcc9..000000000 --- a/runtimes/neurun/test/graph/operation/SetIO.cc +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <gtest/gtest.h> - -#include "graph/Graph.h" -#include "cpp14/memory.h" -#include "model/operation/Conv2DNode.h" -#include "model/operation/ConcatNode.h" -#include "model/operand/Index.h" -#include "model/operand/IndexSet.h" - -#include <stdexcept> - -using Index = neurun::model::operand::IO::Index; -using IndexSet = neurun::model::operand::IndexSet; -using GraphNodeInitParam = neurun::model::operation::Node::InitParam; - -TEST(graph_operation_setIO, operation_setIO_conv) -{ - neurun::graph::Graph graph; - - neurun::model::operand::Shape shape{1u}; - neurun::model::operand::TypeInfo type{ANEURALNETWORKS_TENSOR_INT32, 0, 0}; - shape.dim(0) = 3; - - // Add Conv - std::vector<uint32_t> params; - for (int i = 0; i < 7; ++i) - { - params.emplace_back(graph.addOperand(shape, type).asInt()); - } - uint32_t outoperand = graph.addOperand(shape, type).asInt(); - - using GraphNode = neurun::model::operation::Conv2DNode; - - auto conv = - nnfw::cpp14::make_unique<GraphNode>(GraphNodeInitParam{7, params.data(), 1, &outoperand}); - ASSERT_EQ(conv->getInputs().at(Index{0}).asInt(), params[0]); - conv->setInputs({8, 9, 10}); - ASSERT_NE(conv->getInputs().at(Index{0}).asInt(), params[0]); - ASSERT_EQ(conv->getInputs().at(Index{0}).asInt(), 8); -} - -TEST(graph_operation_setIO, operation_setIO_concat) -{ - neurun::graph::Graph graph; - - neurun::model::operand::Shape shape{1u}; - neurun::model::operand::TypeInfo type{ANEURALNETWORKS_TENSOR_INT32, 0, 0}; - shape.dim(0) = 3; - - // Add Concat - std::vector<uint32_t> params; - for (int i = 0; i < 7; ++i) - { - params.emplace_back(graph.addOperand(shape, type).asInt()); - } - uint32_t outoperand = graph.addOperand(shape, type).asInt(); - - using GraphNode = neurun::model::operation::ConcatNode; - - auto concat = - nnfw::cpp14::make_unique<GraphNode>(GraphNodeInitParam{7, params.data(), 1, &outoperand}); - - ASSERT_EQ(concat->getInputs().size(), 6); - ASSERT_EQ(concat->getInputs().at(Index{0}).asInt(), params[0]); - - concat->setInputs({80, 6, 9, 11}); - ASSERT_EQ(concat->getInputs().size(), 4); - ASSERT_NE(concat->getInputs().at(Index{0}).asInt(), params[0]); - ASSERT_EQ(concat->getInputs().at(Index{0}).asInt(), 80); - ASSERT_EQ(concat->getInputs().at(Index{2}).asInt(), 9); - ASSERT_THROW(concat->getInputs().at(Index{5}), std::out_of_range); -} diff --git a/runtimes/neurun/test/graph/verifier/Verifier.cc b/runtimes/neurun/test/graph/verifier/Verifier.cc deleted file mode 100644 index a37b0ac1f..000000000 --- a/runtimes/neurun/test/graph/verifier/Verifier.cc +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <gtest/gtest.h> - -#include "model/operation/Node.h" -#include "graph/Graph.h" -#include "graph/verifier/Verifier.h" -#include "cpp14/memory.h" -#include "model/operand/Object.h" -#include "../MockNode.h" - -using IndexSet = neurun::model::operand::IndexSet; -using MockNode = neurun_test::graph::SimpleMockNode; - -TEST(Verifier, dag_checker) -{ - neurun::graph::Graph graph; - 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; - - auto operand1 = graph.addOperand(shape, type); - auto operand2 = graph.addOperand(shape, type); - - graph.addInput(operand1); - graph.operands().at(operand1).setAsModelInput(); - graph.addOutput(operand2); - graph.operands().at(operand2).setAsOperationOutput(); - - graph.addOperation(nnfw::cpp14::make_unique<MockNode>(IndexSet{operand1}, IndexSet{operand2})); - - graph.finishBuilding(); - - ASSERT_EQ(verifier.verify(graph), true); -} diff --git a/runtimes/neurun/test/model.cc b/runtimes/neurun/test/model.cc deleted file mode 100644 index 2ba22a204..000000000 --- a/runtimes/neurun/test/model.cc +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <gtest/gtest.h> - -#include "frontend/wrapper/model.h" - -TEST(MODEL, model_build) -{ - ANeuralNetworksModel model; - ASSERT_EQ(model.isFinished(), false); -} |