diff options
author | surmeh01 <surabhi.mehta@arm.com> | 2018-05-18 16:31:43 +0100 |
---|---|---|
committer | telsoa01 <telmo.soares@arm.com> | 2018-05-23 13:09:07 +0100 |
commit | 3537c2ca7ebf31c1673b9ec2bb0c17b0406bbae0 (patch) | |
tree | 5950603ad78ec3fe56fb31ddc7f4d52a19f5bc60 /src/armnn/layers/LayerWithParameters.hpp | |
parent | bceff2fb3fc68bb0aa88b886900c34b77340c826 (diff) | |
download | armnn-3537c2ca7ebf31c1673b9ec2bb0c17b0406bbae0.tar.gz |
Release 18.05
Diffstat (limited to 'src/armnn/layers/LayerWithParameters.hpp')
-rw-r--r-- | src/armnn/layers/LayerWithParameters.hpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/armnn/layers/LayerWithParameters.hpp b/src/armnn/layers/LayerWithParameters.hpp new file mode 100644 index 0000000000..e3eb40a273 --- /dev/null +++ b/src/armnn/layers/LayerWithParameters.hpp @@ -0,0 +1,52 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// See LICENSE file in the project root for full license information. +// +#pragma once + +#include <Layer.hpp> + +namespace armnn +{ + +template <typename Parameters> +class LayerWithParameters : public Layer +{ +public: + using DescriptorType = Parameters; + + const Parameters& GetParameters() const { return m_Param; } + + /// Helper to serialize the layer parameters to string + /// (currently used in DotSerializer and company) + void SerializeLayerParameters(ParameterStringifyFunction & fn) const + { + StringifyLayerParameters<Parameters>::Serialize(fn, m_Param); + } + +protected: + LayerWithParameters(unsigned int numInputSlots, + unsigned int numOutputSlots, + LayerType type, + const Parameters& param, + const char* name) + : Layer(numInputSlots, numOutputSlots, type, name) + , m_Param(param) + { + } + + ~LayerWithParameters() = default; + + /// Helper function to reduce duplication in *Layer::CreateWorkload + template <typename QueueDescriptor> + WorkloadInfo PrepInfoAndDesc(QueueDescriptor& descriptor, const Graph& graph) const + { + descriptor.m_Parameters = m_Param; + return Layer::PrepInfoAndDesc(descriptor, graph); + } + + /// The parameters for the layer (not including tensor-valued weights etc.) + Parameters m_Param; +}; + +} // namespace |