aboutsummaryrefslogtreecommitdiff
path: root/src/armnnSerializer/test/SerializerTests.cpp
diff options
context:
space:
mode:
authorÉanna Ó Catháin <eanna.ocathain@arm.com>2019-02-27 16:16:39 +0000
committerEanna O Cathain Arm <eanna.ocathain@arm.com>2019-02-28 12:21:44 +0000
commit5888589ec877d61d21848816c6eacdde5dc068d6 (patch)
tree36f1f7aecfc32d36e9564ef324a96ab48a473b2d /src/armnnSerializer/test/SerializerTests.cpp
parent315258e6a2692eef2727326508577e5c73194e85 (diff)
downloadarmnn-5888589ec877d61d21848816c6eacdde5dc068d6.tar.gz
IVGCVSW-2687 Add Serializer & Deserializer for Division
Change-Id: I230220eccbfb22e56e8d351cc963988d734836ac Signed-off-by: Éanna Ó Catháin <eanna.ocathain@arm.com>
Diffstat (limited to 'src/armnnSerializer/test/SerializerTests.cpp')
-rw-r--r--src/armnnSerializer/test/SerializerTests.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/armnnSerializer/test/SerializerTests.cpp b/src/armnnSerializer/test/SerializerTests.cpp
index 8ce90499df..13fb0b22f8 100644
--- a/src/armnnSerializer/test/SerializerTests.cpp
+++ b/src/armnnSerializer/test/SerializerTests.cpp
@@ -728,4 +728,49 @@ BOOST_AUTO_TEST_CASE(SerializeDeserializeBatchToSpaceNd)
outputTensorInfo.GetShape());
}
+BOOST_AUTO_TEST_CASE(SerializeDivision)
+{
+ class VerifyDivisionName : public armnn::LayerVisitorBase<armnn::VisitorNoThrowPolicy>
+ {
+ public:
+ void VisitDivisionLayer(const armnn::IConnectableLayer*, const char* name) override
+ {
+ BOOST_TEST(name == "division");
+ }
+ };
+
+ const armnn::TensorInfo info({ 1, 5, 2, 3 }, armnn::DataType::Float32);
+
+ armnn::INetworkPtr network = armnn::INetwork::Create();
+ armnn::IConnectableLayer* const inputLayer0 = network->AddInputLayer(0);
+ armnn::IConnectableLayer* const inputLayer1 = network->AddInputLayer(1);
+
+ const char* divLayerName = "division";
+
+ armnn::IConnectableLayer* const divisionLayer = network->AddDivisionLayer(divLayerName);
+ inputLayer0->GetOutputSlot(0).Connect(divisionLayer->GetInputSlot(0));
+ inputLayer1->GetOutputSlot(0).Connect(divisionLayer->GetInputSlot(1));
+
+ armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
+ divisionLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
+
+ inputLayer0->GetOutputSlot(0).SetTensorInfo(info);
+ inputLayer1->GetOutputSlot(0).SetTensorInfo(info);
+ divisionLayer->GetOutputSlot(0).SetTensorInfo(info);
+
+ armnnSerializer::Serializer serializer;
+ serializer.Serialize(*network);
+
+ std::stringstream stream;
+ serializer.SaveSerializedToStream(stream);
+ BOOST_TEST(stream.str().length() > 0);
+ BOOST_TEST(stream.str().find(divLayerName) != stream.str().npos);
+
+ armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(stream.str());
+ BOOST_CHECK(deserializedNetwork);
+
+ VerifyDivisionName nameChecker;
+ deserializedNetwork->Accept(nameChecker);
+}
+
BOOST_AUTO_TEST_SUITE_END()