ArmNN  NotReleased
ConstantLayer.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 class ScopedCpuTensorHandle;
13 
15 class ConstantLayer : public Layer
16 {
17 public:
22  virtual std::unique_ptr<IWorkload> CreateWorkload(const IWorkloadFactory& factory) const override;
23 
26  ConstantLayer* Clone(Graph& graph) const override;
27 
30  void ValidateTensorShapesFromInputs() override;
31 
36  std::vector<TensorShape> InferOutputShapes(const std::vector<TensorShape>& inputShapes) const override;
37 
39  void ReleaseConstantData() override {}
40 
41  void Accept(ILayerVisitor& visitor) const override;
42 
43  std::unique_ptr<ScopedCpuTensorHandle> m_LayerOutput;
44 
45 protected:
48  ConstantLayer(const char* name);
49 
51  ~ConstantLayer() = default;
52 
54  ConstantTensors GetConstantTensorsByRef() override { return {m_LayerOutput}; }
55 };
56 
57 } // namespace
~ConstantLayer()=default
Default destructor.
ConstantTensors GetConstantTensorsByRef() override
Retrieve the handles to the constant values stored by the layer.
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
void ReleaseConstantData() override
Free up the constant source data stored by the layer.
std::vector< std::reference_wrapper< std::unique_ptr< ScopedCpuTensorHandle > >> ConstantTensors
Definition: Layer.hpp:356
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
void Accept(ILayerVisitor &visitor) const override
ConstantLayer * Clone(Graph &graph) const override
std::unique_ptr< ScopedCpuTensorHandle > m_LayerOutput
A layer that the constant data can be bound to.
void ValidateTensorShapesFromInputs() override
ConstantLayer(const char *name)