From c95b8381ac73a975ad82b930f9ed3049901c6753 Mon Sep 17 00:00:00 2001 From: Sadik Armagan Date: Wed, 23 Oct 2019 11:22:39 +0100 Subject: IVGCVSW-4013 Test that the quantizer fails gracefully * Added Quantizer test for StandIn Layer Signed-off-by: Sadik Armagan Change-Id: I48bb9cadb48e20ee8e5b3dcf9e2f9fdb3b68351d --- src/armnn/test/QuantizerTest.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src') diff --git a/src/armnn/test/QuantizerTest.cpp b/src/armnn/test/QuantizerTest.cpp index e7feef57c5..90fd5e90dd 100644 --- a/src/armnn/test/QuantizerTest.cpp +++ b/src/armnn/test/QuantizerTest.cpp @@ -1179,6 +1179,37 @@ BOOST_AUTO_TEST_CASE(QuantizeSoftmax) VisitLayersTopologically(quantizedNetworkQSymm16.get(), validatorQSymm16); } +BOOST_AUTO_TEST_CASE(QuantizeStandIn) +{ + const TensorShape tensorShape{ 1U }; + const TensorInfo tensorInfo(tensorShape, DataType::Float32); + + INetworkPtr network = INetwork::Create(); + + StandInDescriptor descriptor; + descriptor.m_NumInputs = 1; + descriptor.m_NumOutputs = 1; + + IConnectableLayer* inputLayer = network->AddInputLayer(0); + IConnectableLayer* standInLayer = network->AddStandInLayer(descriptor); + IConnectableLayer* outputLayer = network->AddOutputLayer(0); + + inputLayer->GetOutputSlot(0).Connect(standInLayer->GetInputSlot(0)); + standInLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0)); + + inputLayer->GetOutputSlot(0).SetTensorInfo(tensorInfo); + standInLayer->GetOutputSlot(0).SetTensorInfo(tensorInfo); + + // test QAsymm8 quantization + BOOST_CHECK_THROW(INetworkQuantizer::Create(network.get())->ExportNetwork(), + armnn::UnimplementedException); + + // test QuantisedSymm16 quantization + const QuantizerOptions options(DataType::QuantisedSymm16); + BOOST_CHECK_THROW(INetworkQuantizer::Create(network.get(), options)->ExportNetwork(), + armnn::UnimplementedException); +} + IConnectableLayer* CreateStartOfLeakyReluNetwork(INetwork* network, const TensorInfo& info) { ActivationDescriptor activationDescriptor; -- cgit v1.2.1