From 6940dd720ebb6b3d1df8ca203ab696daefe58189 Mon Sep 17 00:00:00 2001 From: Jim Flynn Date: Fri, 20 Mar 2020 12:25:56 +0000 Subject: renamed Documentation folder 20.02 and added .nojekyll file Signed-off-by: Jim Flynn --- 20.02/_constant_layer_8cpp_source.xhtml | 145 ++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 20.02/_constant_layer_8cpp_source.xhtml (limited to '20.02/_constant_layer_8cpp_source.xhtml') diff --git a/20.02/_constant_layer_8cpp_source.xhtml b/20.02/_constant_layer_8cpp_source.xhtml new file mode 100644 index 0000000000..5fcc645c04 --- /dev/null +++ b/20.02/_constant_layer_8cpp_source.xhtml @@ -0,0 +1,145 @@ + + + + + + + + + + + + + +ArmNN: src/armnn/layers/ConstantLayer.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  20.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
ConstantLayer.cpp
+
+
+Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #include "ConstantLayer.hpp"
6 #include "LayerCloneBase.hpp"
7 
8 #include <armnn/TypesUtils.hpp>
12 
13 namespace armnn
14 {
15 
17  : Layer(0, 1, LayerType::Constant, name)
18 {
19 }
20 
21 std::unique_ptr<IWorkload> ConstantLayer::CreateWorkload(const IWorkloadFactory& factory) const
22 {
23  ConstantQueueDescriptor descriptor;
24  descriptor.m_LayerOutput = m_LayerOutput.get();
25  return factory.CreateConstant(descriptor, PrepInfoAndDesc(descriptor));
26 }
27 
29 {
30  // Cloned layers share the same layer output object.
31  auto layer = CloneBase<ConstantLayer>(graph, GetName());
32 
33  layer->m_LayerOutput = m_LayerOutput ? std::make_unique<ScopedCpuTensorHandle>(*m_LayerOutput) : nullptr;
34 
35  return std::move(layer);
36 }
37 
38 std::vector<TensorShape> ConstantLayer::InferOutputShapes(const std::vector<TensorShape>& inputShapes) const
39 {
40  return std::vector<TensorShape>({ inputShapes[0] });
41 }
42 
44 {
45  // Get the output shape from the value of the constant layer.
46  TensorShape const& outShape = m_LayerOutput->GetTensorInfo().GetShape();
47  ConditionalThrowIfNotEqual<LayerValidationException>(
48  "ConstantLayer: TensorShape set on OutputSlot[0] does not match the inferred shape.",
50  outShape);
51 }
52 
54 {
55  ConstTensor layerOutputTensor(m_LayerOutput->GetTensorInfo(), m_LayerOutput->Map(true)) ;
56  visitor.VisitConstantLayer(this, layerOutputTensor, GetName());
57 }
58 
59 } // namespace armnn
A layer that the constant data can be bound to.
+
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Makes a workload for the Constant type.
+ +
const TensorShape & GetShape() const
Definition: Tensor.hpp:88
+ + + +
void Accept(ILayerVisitor &visitor) const override
Apply a visitor to this layer.
+
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) will lead to a valid configuration of ConstantLayer.
+
const ConstCpuTensorHandle * m_LayerOutput
+
virtual std::unique_ptr< IWorkload > CreateConstant(const ConstantQueueDescriptor &descriptor, const WorkloadInfo &info) const
+
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
By default returns inputShapes if the number of inputs are equal to number of outputs, otherwise infers the output shapes from given input shapes and layer properties.
+
Copyright (c) 2020 ARM Limited.
+ + +
std::unique_ptr< ScopedCpuTensorHandle > m_LayerOutput
+ +
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *LayerCreateWorkload.
Definition: Layer.hpp:351
+
ConstantLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
+
virtual void VisitConstantLayer(const IConnectableLayer *layer, const ConstTensor &input, const char *name=nullptr)=0
Function a layer with no inputs and a single output, which always corresponds to the passed in consta...
+
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
Definition: Tensor.hpp:199
+ + + +
ConstantLayer(const char *name)
Constructor to create a ConstantLayer.
+ +
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
Definition: Layer.hpp:312
+
const char * GetName() const override
Returns the name of the layer.
Definition: Layer.hpp:305
+
const TensorInfo & GetTensorInfo() const override
Definition: Layer.cpp:63
+ + + +
+
+ + + + -- cgit v1.2.1