From add078b7f9a658d52ee6e8fe6771ea0517c07674 Mon Sep 17 00:00:00 2001 From: mathad01 Date: Mon, 10 May 2021 16:51:20 +0100 Subject: IVGCVSW-5908 Update 21.05 Doxygen Documents Signed-off-by: mathad01 Change-Id: I95316d4fc5f9d10185492dc835bb2411c1daea7b --- 21.05/_constant_layer_8cpp_source.xhtml | 156 ++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 21.05/_constant_layer_8cpp_source.xhtml (limited to '21.05/_constant_layer_8cpp_source.xhtml') diff --git a/21.05/_constant_layer_8cpp_source.xhtml b/21.05/_constant_layer_8cpp_source.xhtml new file mode 100644 index 0000000000..4e6d4aff5f --- /dev/null +++ b/21.05/_constant_layer_8cpp_source.xhtml @@ -0,0 +1,156 @@ + + + + + + + + + + + + + +ArmNN: src/armnn/layers/ConstantLayer.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  21.05 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
ConstantLayer.cpp
+
+
+Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd and Contributors. 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  SetAdditionalInfo(descriptor);
26 
27  return factory.CreateConstant(descriptor, PrepInfoAndDesc(descriptor));
28 }
29 
31 {
32  // Cloned layers share the same layer output object.
33  auto layer = CloneBase<ConstantLayer>(graph, GetName());
34 
35  layer->m_LayerOutput = m_LayerOutput ? m_LayerOutput : nullptr;
36 
37  return std::move(layer);
38 }
39 
40 std::vector<TensorShape> ConstantLayer::InferOutputShapes(const std::vector<TensorShape>& inputShapes) const
41 {
42  return std::vector<TensorShape>({ inputShapes[0] });
43 }
44 
46 {
47 
48  // Get the output shape from the value of the constant layer.
49  TensorShape const& outShape = m_LayerOutput->GetTensorInfo().GetShape();
50 
51  ConditionalThrow<LayerValidationException>(
53  "Constant layer m_LayerOutput output shape can not be Dimensionality::NotSpecified");
54 
55  ConditionalThrow<LayerValidationException>(
56  outShape.AreAllDimensionsSpecified(),
57  "Constant layer m_LayerOutput output shape can not have an unspecified dimension");
58 
59  ConditionalThrowIfNotEqual<LayerValidationException>(
60  "ConstantLayer: TensorShape set on OutputSlot[0] does not match the inferred shape.",
62  outShape);
63 }
64 
66 {
67  ManagedConstTensorHandle managedLayerOutput(m_LayerOutput);
68  ConstTensor layerOutputTensor(managedLayerOutput.GetTensorInfo(), managedLayerOutput.Map());
69  visitor.VisitConstantLayer(this, layerOutputTensor, GetName());
70 }
71 
73 {
74  ManagedConstTensorHandle managedLayerOutput(m_LayerOutput);
75  ConstTensor layerOutputTensor(managedLayerOutput.GetTensorInfo(), managedLayerOutput.Map());
76  strategy.ExecuteStrategy(this, BaseDescriptor(), { layerOutputTensor }, GetName());
77 }
78 
79 } // 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:187
+ +
const ConstTensorHandle * m_LayerOutput
+ +
bool AreAllDimensionsSpecified() const
Checks if there is at least one dimension not specified.
Definition: Tensor.cpp:241
+ + + +
void Accept(ILayerVisitor &visitor) const override
Apply a visitor to this layer.
+
std::shared_ptr< ConstTensorHandle > m_LayerOutput
+
Dimensionality GetDimensionality() const
Function that returns the tensor type.
Definition: Tensor.hpp:92
+
virtual void ExecuteStrategy(const armnn::IConnectableLayer *layer, const armnn::BaseDescriptor &descriptor, const std::vector< armnn::ConstTensor > &constants, const char *name, const armnn::LayerBindingId id=0)=0
+
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) will lead to a valid configuration of ConstantLayer.
+
virtual std::unique_ptr< IWorkload > CreateConstant(const ConstantQueueDescriptor &descriptor, const WorkloadInfo &info) const
+
void ExecuteStrategy(IStrategy &strategy) const override
Apply a visitor to this layer.
+
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.
+
const TensorInfo & GetTensorInfo() const
+
Copyright (c) 2021 ARM Limited and Contributors.
+ + +
Base class for all descriptors.
Definition: Descriptors.hpp:22
+ + +
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *LayerCreateWorkload.
Definition: Layer.hpp:381
+
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:314
+ +
void SetAdditionalInfo(QueueDescriptor &descriptor) const
Definition: Layer.cpp:245
+ +
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:318
+
const char * GetName() const override
Returns the name of the layer.
Definition: Layer.hpp:311
+
const void * Map(bool blocking=true)
RAII Managed resource Unmaps MemoryArea once out of scope.
+
const TensorInfo & GetTensorInfo() const override
Definition: Layer.cpp:63
+ + +
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below...
Definition: Types.hpp:455
+
+
+ + + + -- cgit v1.2.1