diff options
author | Teresa Charlin <teresa.charlinreyes@arm.com> | 2019-07-01 16:22:56 +0100 |
---|---|---|
committer | Teresa Charlin <teresa.charlinreyes@arm.com> | 2019-07-01 16:22:56 +0100 |
commit | b17406df856d3557e6ddf7f55505359aecc061d5 (patch) | |
tree | 653e4dc7146cb115e8e92e129dfe55b7c462fe44 /src/armnn/test/QuantizerTest.cpp | |
parent | 970f43b078eba91c66fb64eadbc9803661ffcda8 (diff) | |
download | armnn-b17406df856d3557e6ddf7f55505359aecc061d5.tar.gz |
IVGCVSW-3366 Add Quantizer support for ResizeLayer
Signed-off-by: Teresa Charlin <teresa.charlinreyes@arm.com>
Change-Id: Ibfd4725bb04a5859488e968513cf11ac450fd277
Diffstat (limited to 'src/armnn/test/QuantizerTest.cpp')
-rw-r--r-- | src/armnn/test/QuantizerTest.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/armnn/test/QuantizerTest.cpp b/src/armnn/test/QuantizerTest.cpp index 4732da393f..57f602dbba 100644 --- a/src/armnn/test/QuantizerTest.cpp +++ b/src/armnn/test/QuantizerTest.cpp @@ -1523,6 +1523,54 @@ BOOST_AUTO_TEST_CASE(QuantizeResizeBilinear) VisitLayersTopologically(quantizedNetworkQSymm16.get(), validatorQSymm16); } +BOOST_AUTO_TEST_CASE(QuantizeResize) +{ + class TestResizeQuantization : public TestLeakyReLuActivationQuantization + { + public: + TestResizeQuantization(const TensorShape& inputShape, const TensorShape& outputShape) + : TestLeakyReLuActivationQuantization(inputShape, outputShape) + {} + + TestResizeQuantization(const QuantizerOptions& options, + const TensorShape& inputShape, + const TensorShape& outputShape) + : TestLeakyReLuActivationQuantization(options, inputShape, outputShape) + {} + + void VisitResizeLayer(const IConnectableLayer* layer, + const ResizeDescriptor& resizeDescriptor, + const char* name = nullptr) override + { + CheckForwardedQuantizationSettings(layer); + } + }; + + INetworkPtr network = INetwork::Create(); + + const TensorShape shape{1U}; + TensorInfo info(shape, DataType::Float32); + + IConnectableLayer* activation = CreateStartOfLeakyReluNetwork(network.get(), info); + + // Add the layer under test + ResizeDescriptor descriptor; + descriptor.m_TargetHeight = 3; + descriptor.m_TargetWidth = 3; + IConnectableLayer* resizeLayer = network->AddResizeLayer(descriptor); + + CompleteLeakyReluNetwork(network.get(), activation, resizeLayer, info); + + INetworkPtr quantizedNetworkQAsymm8 = INetworkQuantizer::Create(network.get())->ExportNetwork(); + TestResizeQuantization validatorQAsymm8(shape, shape); + VisitLayersTopologically(quantizedNetworkQAsymm8.get(), validatorQAsymm8); + + const QuantizerOptions options(DataType::QuantisedSymm16); + INetworkPtr quantizedNetworkQSymm16 = INetworkQuantizer::Create(network.get(), options)->ExportNetwork(); + TestResizeQuantization validatorQSymm16(options, shape, shape); + VisitLayersTopologically(quantizedNetworkQSymm16.get(), validatorQSymm16); +} + BOOST_AUTO_TEST_CASE(QuantizeStridedSlice) { class TestStridedSliceQuantization : public TestLeakyReLuActivationQuantization |