Mike Kelly | 8c1701a | 2019-02-11 17:01:27 +0000 | [diff] [blame^] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include <armnn/ArmNN.hpp> |
| 7 | #include <armnn/INetwork.hpp> |
| 8 | #include "../Serializer.hpp" |
| 9 | #include <sstream> |
| 10 | #include <boost/test/unit_test.hpp> |
| 11 | |
| 12 | BOOST_AUTO_TEST_SUITE(SerializerTests) |
| 13 | |
| 14 | BOOST_AUTO_TEST_CASE(SimpleNetworkSerialization) |
| 15 | { |
| 16 | armnn::INetworkPtr network = armnn::INetwork::Create(); |
| 17 | armnn::IConnectableLayer* const inputLayer0 = network->AddInputLayer(0); |
| 18 | armnn::IConnectableLayer* const inputLayer1 = network->AddInputLayer(1); |
| 19 | |
| 20 | armnn::IConnectableLayer* const additionLayer0 = network->AddAdditionLayer(); |
| 21 | inputLayer0->GetOutputSlot(0).Connect(additionLayer0->GetInputSlot(0)); |
| 22 | inputLayer1->GetOutputSlot(0).Connect(additionLayer0->GetInputSlot(1)); |
| 23 | |
| 24 | armnn::IConnectableLayer* const outputLayer0 = network->AddOutputLayer(0); |
| 25 | additionLayer0->GetOutputSlot(0).Connect(outputLayer0->GetInputSlot(0)); |
| 26 | |
| 27 | armnnSerializer::Serializer serializer; |
| 28 | serializer.Serialize(*network); |
| 29 | |
| 30 | std::stringstream stream; |
| 31 | serializer.SaveSerializedToStream(stream); |
| 32 | BOOST_TEST(stream.str().length() > 0); |
| 33 | } |
| 34 | |
| 35 | BOOST_AUTO_TEST_SUITE_END() |