From fd627ffaec8fd8801d980b4c91ee7c0607ab6aaf Mon Sep 17 00:00:00 2001 From: Jan Eilers Date: Thu, 25 Feb 2021 17:44:00 +0000 Subject: IVGCVSW-5687 Update Doxygen Docu * Update Doxygen Documentation for 21.02 release Signed-off-by: Jan Eilers Change-Id: I9ed2f9caab038836ea99d7b378d7899fe431a4e5 --- 21.02/_elementwise_base_layer_8cpp_source.xhtml | 148 ++++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 21.02/_elementwise_base_layer_8cpp_source.xhtml (limited to '21.02/_elementwise_base_layer_8cpp_source.xhtml') diff --git a/21.02/_elementwise_base_layer_8cpp_source.xhtml b/21.02/_elementwise_base_layer_8cpp_source.xhtml new file mode 100644 index 0000000000..2784c8a146 --- /dev/null +++ b/21.02/_elementwise_base_layer_8cpp_source.xhtml @@ -0,0 +1,148 @@ + + + + + + + + + + + + + +ArmNN: src/armnn/layers/ElementwiseBaseLayer.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  21.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
ElementwiseBaseLayer.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 
7 
8 #include "InternalTypes.hpp"
9 #include "armnn/Exceptions.hpp"
10 #include <armnn/TypesUtils.hpp>
11 #include <armnn/utility/Assert.hpp>
12 
13 namespace armnn
14 {
15 
16 ElementwiseBaseLayer::ElementwiseBaseLayer(unsigned int numInputSlots, unsigned int numOutputSlots,
17  LayerType type, const char* name)
18  : Layer(numInputSlots, numOutputSlots, type, name)
19 {
20 }
21 
22 std::vector<TensorShape> ElementwiseBaseLayer::InferOutputShapes(const std::vector<TensorShape>& inputShapes) const
23 {
24  ARMNN_ASSERT(inputShapes.size() == 2);
25  TensorShape input0 = inputShapes[0];
26  TensorShape input1 = inputShapes[1];
27 
29  {
30  ARMNN_ASSERT(input0.GetNumDimensions() == input1.GetNumDimensions());
31  }
33  inputShapes[0].GetNumDimensions() < inputShapes[1].GetNumDimensions())
34  {
35  input1 = inputShapes[0];
36  input0 = inputShapes[1];
37  }
38 
39  unsigned int numDims = input0.GetNumDimensions();
40  unsigned int shiftedDims = input0.GetNumDimensions() - input1.GetNumDimensions();
41 
42  // Get the max of the inputs.
43  std::vector<unsigned int> dims(numDims);
44  for (unsigned int i = shiftedDims; i < numDims; i++)
45  {
46  unsigned int dim0 = input0[i];
47  unsigned int dim1 = input1[i - shiftedDims];
48 
49 #if !NDEBUG
50  // Validate inputs are broadcast compatible.
51  ARMNN_ASSERT_MSG(dim0 == dim1 || dim0 == 1 || dim1 == 1,
52  "Dimensions should either match or one should be of size 1.");
53 #endif
54 
55  dims[i] = std::max(dim0, dim1);
56  }
57 
58  // Fill in the rest of the shifted dimensions.
59  for (unsigned int i = 0; i < shiftedDims; i++)
60  {
61  dims[i] = input0[i];
62  }
63 
64  return std::vector<TensorShape>({ TensorShape(numDims, dims.data()) });
65 }
66 
68 {
70 
71  const TensorShape& outputShape = GetOutputSlot(0).GetTensorInfo().GetShape();
72 
74 
75  auto inferredShapes = InferOutputShapes({
78  });
79 
80  ARMNN_ASSERT(inferredShapes.size() == 1);
81 
82  ValidateAndCopyShape(outputShape, inferredShapes[0], m_ShapeInferenceMethod, GetLayerTypeAsCString(GetType()));
83 }
84 
86 {
87  strategy.ExecuteStrategy(this, BaseDescriptor(), {}, GetName());
88 }
89 
90 } // namespace armnn
const TensorShape & GetShape() const
Definition: Tensor.hpp:187
+
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.
+
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 VerifyShapeInferenceType(const TensorShape &outputShape, ShapeInferenceMethod shapeInferenceMethod)
Definition: Layer.cpp:432
+
Copyright (c) 2021 ARM Limited and Contributors.
+ +
const IOutputSlot * GetConnection() const override
Definition: Layer.hpp:199
+ +
void ValidateAndCopyShape(const TensorShape &outputShape, const TensorShape &inferredShape, const ShapeInferenceMethod shapeInferenceMethod, const std::string &layerName, const unsigned int outputSlotIndex=0)
Definition: Layer.cpp:392
+
Base class for all descriptors.
Definition: Descriptors.hpp:22
+ +
void VerifyLayerConnections(unsigned int expectedConnections, const CheckLocation &location) const
Definition: Layer.cpp:348
+
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
Definition: Layer.hpp:316
+ +
#define ARMNN_ASSERT_MSG(COND, MSG)
Definition: Assert.hpp:15
+
Validate all output shapes.
+
LayerType GetType() const override
Returns the armnn::LayerType of this layer.
Definition: Layer.hpp:265
+
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
+
#define CHECK_LOCATION()
Definition: Exceptions.hpp:197
+ +
ElementwiseBaseLayer(unsigned int numInputSlots, unsigned int numOutputSlots, LayerType type, const char *name)
+ +
unsigned int GetNumDimensions() const
Function that returns the tensor rank.
Definition: Tensor.cpp:174
+
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
Definition: Layer.hpp:318
+
Infer missing output shapes and validate all output shapes.
+
virtual const TensorInfo & GetTensorInfo() const =0
+
const char * GetName() const override
Returns the name of the layer.
Definition: Layer.hpp:311
+ +
void ExecuteStrategy(IStrategy &strategy) const override
Apply a visitor to this layer.
+
const TensorInfo & GetTensorInfo() const override
Definition: Layer.cpp:63
+
const char * GetLayerTypeAsCString(LayerType type)
+
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) will lead to a valid configuration of the element wise operation...
+
ShapeInferenceMethod m_ShapeInferenceMethod
Definition: Layer.hpp:408
+ +
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below...
Definition: Types.hpp:419
+
+
+ + + + -- cgit v1.2.1