aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Flynn <jim.flynn@arm.com>2019-02-18 10:42:32 +0000
committerJim Flynn <jim.flynn@arm.com>2019-02-18 10:42:32 +0000
commit2ee88dfe7096f8f571ae7be9cbf0f49ededd89af (patch)
tree85f3188cdf268842d9dc293bb1aced01188d6016
parentaa80d8a9f334254188aa244d3a438846f3996177 (diff)
downloadarmnn-2ee88dfe7096f8f571ae7be9cbf0f49ededd89af.tar.gz
IVGCVSW-2626 Add Quantization of ResizeBilinear Layer
Change-Id: I0daffd23f32cc094d8309aed822cc46bb2aaa46f Signed-off-by: Jim Flynn <jim.flynn@arm.com>
-rw-r--r--src/armnn/QuantizerVisitor.cpp9
-rw-r--r--src/armnn/QuantizerVisitor.hpp4
-rw-r--r--src/armnn/StaticRangeVisitor.cpp10
-rw-r--r--src/armnn/StaticRangeVisitor.hpp4
-rw-r--r--src/armnn/test/QuantizerTest.cpp33
5 files changed, 60 insertions, 0 deletions
diff --git a/src/armnn/QuantizerVisitor.cpp b/src/armnn/QuantizerVisitor.cpp
index 2ca164bf36..8b009c679f 100644
--- a/src/armnn/QuantizerVisitor.cpp
+++ b/src/armnn/QuantizerVisitor.cpp
@@ -280,4 +280,13 @@ void QuantizerVisitor::VisitReshapeLayer(const IConnectableLayer* layer,
SetQuantizedInputConnections(layer, newLayer);
}
+void QuantizerVisitor::VisitResizeBilinearLayer(const IConnectableLayer* layer,
+ const ResizeBilinearDescriptor& resizeDesc,
+ const char* name)
+{
+ IConnectableLayer* newLayer = m_QuantizedNetwork->AddResizeBilinearLayer(resizeDesc, name);
+ RecordLayer(layer, newLayer);
+ SetQuantizedInputConnections(layer, newLayer);
+}
+
} //namespace armnn
diff --git a/src/armnn/QuantizerVisitor.hpp b/src/armnn/QuantizerVisitor.hpp
index 79c44f2a60..2ccbac2ffc 100644
--- a/src/armnn/QuantizerVisitor.hpp
+++ b/src/armnn/QuantizerVisitor.hpp
@@ -96,6 +96,10 @@ public:
const ReshapeDescriptor& reshapeDescriptor,
const char* name = nullptr) override;
+ void VisitResizeBilinearLayer(const IConnectableLayer* layer,
+ const ResizeBilinearDescriptor& resizeDesc,
+ const char* name = nullptr) override;
+
/// Extract the quantized network
INetworkPtr RetrieveFinalNetwork() { return std::move(m_QuantizedNetwork); }
diff --git a/src/armnn/StaticRangeVisitor.cpp b/src/armnn/StaticRangeVisitor.cpp
index ad2de63d2e..15f4616988 100644
--- a/src/armnn/StaticRangeVisitor.cpp
+++ b/src/armnn/StaticRangeVisitor.cpp
@@ -212,6 +212,16 @@ void StaticRangeVisitor::VisitSplitterLayer(const IConnectableLayer* layer,
const char* name)
{
boost::ignore_unused(splitterDescriptor);
+ boost::ignore_unused(name);
+ ForwardParentParameters(layer);
+}
+
+void StaticRangeVisitor::VisitResizeBilinearLayer(const IConnectableLayer* layer,
+ const ResizeBilinearDescriptor& resizeDesc,
+ const char* name)
+{
+ boost::ignore_unused(resizeDesc);
+ boost::ignore_unused(name);
ForwardParentParameters(layer);
}
diff --git a/src/armnn/StaticRangeVisitor.hpp b/src/armnn/StaticRangeVisitor.hpp
index a42ad37286..6984346a7f 100644
--- a/src/armnn/StaticRangeVisitor.hpp
+++ b/src/armnn/StaticRangeVisitor.hpp
@@ -87,6 +87,10 @@ public:
const SplitterDescriptor& splitterDescriptor,
const char* name = nullptr) override;
+ void VisitResizeBilinearLayer(const IConnectableLayer* layer,
+ const ResizeBilinearDescriptor& resizeDesc,
+ const char* name = nullptr) override;
+
private:
/// Set the range for an output slot on a layer
void SetRange(const IConnectableLayer* layer, unsigned int outputIdx, float min, float max);
diff --git a/src/armnn/test/QuantizerTest.cpp b/src/armnn/test/QuantizerTest.cpp
index 1f6537d16a..21ac3e66ec 100644
--- a/src/armnn/test/QuantizerTest.cpp
+++ b/src/armnn/test/QuantizerTest.cpp
@@ -1120,5 +1120,38 @@ BOOST_AUTO_TEST_CASE(QuantizeSplitter)
VisitLayersTopologically(quantizedNetwork.get(), validator);
}
+BOOST_AUTO_TEST_CASE(QuantizeResizeBilinear)
+{
+ class TestResizeBilinearQuantization : public TestLeakyReLuActivationQuantization
+ {
+ public:
+ void VisitResizeBilinearLayer(const IConnectableLayer* layer,
+ const ResizeBilinearDescriptor& resizeDescriptor,
+ const char* name = nullptr) override
+ {
+ CheckForwardedQuantizationSettings(layer);
+ }
+ };
+
+ INetworkPtr network = INetwork::Create();
+
+ TensorShape shape{1U};
+ TensorInfo info(shape, DataType::Float32);
+
+ IConnectableLayer* activation = CreateStartOfLeakyReluNetwork(network.get(), info);
+
+ // Add the layer under test
+ ResizeBilinearDescriptor descriptor;
+ descriptor.m_TargetHeight = 3;
+ descriptor.m_TargetWidth = 3;
+ IConnectableLayer* spaceToBatch = network->AddResizeBilinearLayer(descriptor);
+
+ CompleteLeakyReluNetwork(network.get(), activation, spaceToBatch, info);
+
+ auto quantizedNetwork = INetworkQuantizer::Create(network.get())->ExportNetwork();
+ TestResizeBilinearQuantization validator;
+ VisitLayersTopologically(quantizedNetwork.get(), validator);
+}
+
BOOST_AUTO_TEST_SUITE_END()
} // namespace armnn