ArmNN
 20.11
LayerWithParameters.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include <Layer.hpp>
8 
9 namespace armnn
10 {
11 
12 template <typename Parameters>
13 class LayerWithParameters : public Layer
14 {
15 public:
16  using DescriptorType = Parameters;
17 
18  const Parameters& GetParameters() const { return m_Param; }
19 
20  /// Helper to serialize the layer parameters to string
21  /// (currently used in DotSerializer and company).
23  {
26  }
27 
28 protected:
29  LayerWithParameters(unsigned int numInputSlots,
30  unsigned int numOutputSlots,
31  LayerType type,
32  const Parameters& param,
33  const char* name)
34  : Layer(numInputSlots, numOutputSlots, type, name)
35  , m_Param(param)
36  {
37  }
38 
39  ~LayerWithParameters() = default;
40 
41  /// Helper function to reduce duplication in *Layer::CreateWorkload.
42  template <typename QueueDescriptor>
44  {
45  descriptor.m_Parameters = m_Param;
46  return Layer::PrepInfoAndDesc(descriptor);
47  }
48 
49  /// The parameters for the layer (not including tensor-valued weights etc.).
50  Parameters m_Param;
51 };
52 
53 } // namespace
LayerWithParameters(unsigned int numInputSlots, unsigned int numOutputSlots, LayerType type, const Parameters &param, const char *name)
Parameters m_Param
The parameters for the layer (not including tensor-valued weights etc.).
const Parameters & GetParameters() const
void SerializeLayerParameters(ParameterStringifyFunction &fn) const override
Helper to serialize the layer parameters to string (currently used in DotSerializer and company)...
Copyright (c) 2020 ARM Limited.
A ResizeDescriptor for the ResizeLayer.
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *LayerCreateWorkload.
Definition: Layer.hpp:378
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *LayerCreateWorkload.
virtual void SerializeLayerParameters(ParameterStringifyFunction &fn) const
Helper to serialize the layer parameters to string.
Definition: Layer.cpp:446
Contains information about inputs and outputs to a layer.
std::function< void(const std::string &name, const std::string &value)> ParameterStringifyFunction
static void Serialize(ParameterStringifyFunction &, const LayerParameter &)