aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/QuantizerVisitor.cpp
diff options
context:
space:
mode:
authorJim Flynn <jim.flynn@arm.com>2019-02-11 10:30:30 +0000
committerJim Flynn <jim.flynn@arm.com>2019-02-11 11:46:55 +0000
commit3dad5acc5d8eda6fc472b9a255c1d893d4e1f942 (patch)
treef992225a02b8fd3ce87d5ff8aa08a542aab2c790 /src/armnn/QuantizerVisitor.cpp
parente604cde16fc16dc5fea9fc2c1c38ac8e8e2c4a59 (diff)
downloadarmnn-3dad5acc5d8eda6fc472b9a255c1d893d4e1f942.tar.gz
IVGCVSW-2622 Add static quantization of 2DConvolution
Change-Id: If7985a54eba97f7c61413e0804879e4afbf65c4d Signed-off-by: Jim Flynn <jim.flynn@arm.com>
Diffstat (limited to 'src/armnn/QuantizerVisitor.cpp')
-rw-r--r--src/armnn/QuantizerVisitor.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/armnn/QuantizerVisitor.cpp b/src/armnn/QuantizerVisitor.cpp
index 97a8bc1ad2..c5e203ef86 100644
--- a/src/armnn/QuantizerVisitor.cpp
+++ b/src/armnn/QuantizerVisitor.cpp
@@ -153,4 +153,39 @@ void QuantizerVisitor::VisitBatchNormalizationLayer(const IConnectableLayer* lay
SetQuantizedInputConnections(layer, newLayer);
}
+void QuantizerVisitor::VisitConvolution2dLayer(const IConnectableLayer* layer,
+ const Convolution2dDescriptor& convolution2dDescriptor,
+ const ConstTensor& weights,
+ const char* name)
+{
+ std::vector<uint8_t> weightsBacking;
+ ConstTensor qWeights = CreateQuantizedConst(weights, weightsBacking);
+
+ IConnectableLayer* newLayer = m_QuantizedNetwork->AddConvolution2dLayer(convolution2dDescriptor,
+ qWeights,
+ name);
+ RecordLayer(layer, newLayer);
+ SetQuantizedInputConnections(layer, newLayer);
+}
+
+void QuantizerVisitor::VisitConvolution2dLayer(const IConnectableLayer* layer,
+ const Convolution2dDescriptor& convolution2dDescriptor,
+ const ConstTensor& weights,
+ const ConstTensor& biases,
+ const char* name)
+{
+ std::vector<uint8_t> weightsBacking;
+ ConstTensor qWeights = CreateQuantizedConst(weights, weightsBacking);
+
+ std::vector<uint8_t> biasesBacking;
+ ConstTensor qBiases = CreateQuantizedConst(weights, biasesBacking);
+
+ IConnectableLayer* newLayer = m_QuantizedNetwork->AddConvolution2dLayer(convolution2dDescriptor,
+ qWeights,
+ qBiases,
+ name);
+ RecordLayer(layer, newLayer);
+ SetQuantizedInputConnections(layer, newLayer);
+}
+
} //namespace armnn