aboutsummaryrefslogtreecommitdiff
path: root/src/armnnSerializer/test/SerializerTests.cpp
diff options
context:
space:
mode:
authorEllen Norris-Thompson <ellen.norris-thompson@arm.com>2019-06-19 11:46:21 +0100
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-06-19 16:27:26 +0000
commit51982472bfedf12e7d82cde6614617f94b2c86d0 (patch)
tree0e2bef4812e0a3128b47a81f393dd6583d45e4c7 /src/armnnSerializer/test/SerializerTests.cpp
parenta4812b6cd54e4dc4903f457066281d8bf0ccf448 (diff)
downloadarmnn-51982472bfedf12e7d82cde6614617f94b2c86d0.tar.gz
IVGCVSW-3269 Add Serialization support for the new Prelu Activation layer
* Adds serialization/deserialization support * Adds related unit test Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com> Change-Id: I600322b03e51f443cbcd9262bb27e36e5fd95ae5
Diffstat (limited to 'src/armnnSerializer/test/SerializerTests.cpp')
-rw-r--r--src/armnnSerializer/test/SerializerTests.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/armnnSerializer/test/SerializerTests.cpp b/src/armnnSerializer/test/SerializerTests.cpp
index a757e16436..812a4780f4 100644
--- a/src/armnnSerializer/test/SerializerTests.cpp
+++ b/src/armnnSerializer/test/SerializerTests.cpp
@@ -1499,6 +1499,49 @@ BOOST_AUTO_TEST_CASE(SerializeMultiplication)
deserializedNetwork->Accept(verifier);
}
+BOOST_AUTO_TEST_CASE(SerializePrelu)
+{
+ class PreluLayerVerifier : public LayerVerifierBase
+ {
+ public:
+ PreluLayerVerifier(const std::string& layerName,
+ const std::vector<armnn::TensorInfo>& inputInfos,
+ const std::vector<armnn::TensorInfo>& outputInfos)
+ : LayerVerifierBase(layerName, inputInfos, outputInfos) {}
+
+ void VisitPreluLayer(const armnn::IConnectableLayer* layer, const char* name) override
+ {
+ VerifyNameAndConnections(layer, name);
+ }
+ };
+
+ const std::string layerName("prelu");
+
+ armnn::TensorInfo inputTensorInfo ({ 4, 1, 2 }, armnn::DataType::Float32);
+ armnn::TensorInfo alphaTensorInfo ({ 5, 4, 3, 1 }, armnn::DataType::Float32);
+ armnn::TensorInfo outputTensorInfo({ 5, 4, 3, 2 }, armnn::DataType::Float32);
+
+ armnn::INetworkPtr network = armnn::INetwork::Create();
+ armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
+ armnn::IConnectableLayer* const alphaLayer = network->AddInputLayer(1);
+ armnn::IConnectableLayer* const preluLayer = network->AddPreluLayer(layerName.c_str());
+ armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
+
+ inputLayer->GetOutputSlot(0).Connect(preluLayer->GetInputSlot(0));
+ alphaLayer->GetOutputSlot(0).Connect(preluLayer->GetInputSlot(1));
+ preluLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
+
+ inputLayer->GetOutputSlot(0).SetTensorInfo(inputTensorInfo);
+ alphaLayer->GetOutputSlot(0).SetTensorInfo(alphaTensorInfo);
+ preluLayer->GetOutputSlot(0).SetTensorInfo(outputTensorInfo);
+
+ armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
+ BOOST_CHECK(deserializedNetwork);
+
+ PreluLayerVerifier verifier(layerName, {inputTensorInfo, alphaTensorInfo}, {outputTensorInfo});
+ deserializedNetwork->Accept(verifier);
+}
+
BOOST_AUTO_TEST_CASE(SerializeNormalization)
{
class NormalizationLayerVerifier : public LayerVerifierBase