Release 18.08
[platform/upstream/armnn.git] / src / armnn / layers / ConstantLayer.hpp
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // See LICENSE file in the project root for full license information.
4 //
5 #pragma once
6
7 #include <Layer.hpp>
8
9 namespace armnn
10 {
11
12 class ScopedCpuTensorHandle;
13
14 class ConstantLayer : public Layer
15 {
16 public:
17     virtual std::unique_ptr<IWorkload> CreateWorkload(const Graph& graph,
18         const IWorkloadFactory& factory) const override;
19
20     ConstantLayer* Clone(Graph& graph) const override;
21
22     void ValidateTensorShapesFromInputs() override;
23
24     std::vector<TensorShape> InferOutputShapes(const std::vector<TensorShape>& inputShapes) const override;
25
26     // Free up the constant source data
27     void ReleaseConstantData() override {};
28
29     std::unique_ptr<ScopedCpuTensorHandle> m_LayerOutput;
30 protected:
31     ConstantLayer(const char* name);
32     ~ConstantLayer() = default;
33
34     ConstantTensors GetConstantTensorsByRef() override { return {m_LayerOutput}; }
35
36 };
37
38 } // namespace