diff options
author | Derek Lamberti <derek.lamberti@arm.com> | 2019-02-05 16:00:08 +0000 |
---|---|---|
committer | Derek Lamberti <derek.lamberti@arm.com> | 2019-02-06 10:38:09 +0000 |
commit | 27d830720ed706f187f2a40e2c5055e424aa8b91 (patch) | |
tree | 7aac5ae83c79bf53e69f5951871f5cafd232d0a3 /src/armnn/StaticRangeVisitor.hpp | |
parent | f08876fce2b472a8c31f09d976fbcfeaaa94d228 (diff) | |
download | armnn-27d830720ed706f187f2a40e2c5055e424aa8b91.tar.gz |
IVGCVSW-2606 Produce quantized InputNetwork from simple FP32 InputNetwork
Change-Id: I2140a7af5961ddf8267fbb127202de3900ea79e3
Signed-off-by: Derek Lamberti <derek.lamberti@arm.com>
Diffstat (limited to 'src/armnn/StaticRangeVisitor.hpp')
-rw-r--r-- | src/armnn/StaticRangeVisitor.hpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/armnn/StaticRangeVisitor.hpp b/src/armnn/StaticRangeVisitor.hpp new file mode 100644 index 0000000000..38f0088523 --- /dev/null +++ b/src/armnn/StaticRangeVisitor.hpp @@ -0,0 +1,45 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +#include "LayerVisitorBase.hpp" + +#include <armnn/INetwork.hpp> + +#include <map> +#include <vector> + +namespace armnn +{ + +/// Visitor class to establish min/max ranges based on the type of the layer +class StaticRangeVisitor : public LayerVisitorBase +{ +public: + StaticRangeVisitor() = default; + ~StaticRangeVisitor() = default; + + using MinMaxRange = std::pair<float, float>; + using MinMaxRanges = std::vector<MinMaxRange>; + + /// Functions to set the Range on a per-layer-type basis + void VisitAdditionLayer(const IConnectableLayer *layer, const char *name = nullptr) override; + + /// Retreive the default range + MinMaxRange DefaultRange() const { return std::make_pair(-15.0f, 15.0f); } + + /// Retreive the Range for a particular output slot on a particular layer + MinMaxRange GetRange(LayerGuid guid, unsigned int idx) const; + +private: + /// Set the range for an output slot on a layer + void SetRange(const IConnectableLayer* layer, unsigned int outputIdx, float min, float max); + + /// Mapping from Guid to an array of ranges for outputs + std::map<LayerGuid, MinMaxRanges> m_GuidToRangesMap; +}; + +} //namespace armnn
\ No newline at end of file |