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 --- ...ions_1_1_fold_pad_into_convolution2d_impl.xhtml | 241 +++++++++++++++++++++ 1 file changed, 241 insertions(+) create mode 100644 21.02/classarmnn_1_1optimizations_1_1_fold_pad_into_convolution2d_impl.xhtml (limited to '21.02/classarmnn_1_1optimizations_1_1_fold_pad_into_convolution2d_impl.xhtml') diff --git a/21.02/classarmnn_1_1optimizations_1_1_fold_pad_into_convolution2d_impl.xhtml b/21.02/classarmnn_1_1optimizations_1_1_fold_pad_into_convolution2d_impl.xhtml new file mode 100644 index 0000000000..a512d2a43d --- /dev/null +++ b/21.02/classarmnn_1_1optimizations_1_1_fold_pad_into_convolution2d_impl.xhtml @@ -0,0 +1,241 @@ + + + + + + + + + + + + + +ArmNN: FoldPadIntoConvolution2dImpl Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  21.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
FoldPadIntoConvolution2dImpl Class Reference
+
+
+ +

#include <FoldPadIntoConvolution2d.hpp>

+ + + + +

+Public Member Functions

void Run (Graph &graph, InputSlot &connection) const
 
+ + + + + +

+Protected Member Functions

 FoldPadIntoConvolution2dImpl ()=default
 
 ~FoldPadIntoConvolution2dImpl ()=default
 
+

Detailed Description

+
+

Definition at line 17 of file FoldPadIntoConvolution2d.hpp.

+

Constructor & Destructor Documentation

+ +

◆ FoldPadIntoConvolution2dImpl()

+ +
+
+ + + + + +
+ + + + + + + +
FoldPadIntoConvolution2dImpl ()
+
+protecteddefault
+
+
+ +

◆ ~FoldPadIntoConvolution2dImpl()

+ +
+
+ + + + + +
+ + + + + + + +
~FoldPadIntoConvolution2dImpl ()
+
+protecteddefault
+
+
+

Member Function Documentation

+ +

◆ Run()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void Run (Graphgraph,
InputSlotconnection 
) const
+
+inline
+
+ +

Definition at line 21 of file FoldPadIntoConvolution2d.hpp.

+ +

References ARMNN_ASSERT, ARMNN_ASSERT_MSG, armnn::Convolution2d, FoldPadIntoConvolution2dImpl::FoldPadIntoConvolution2dImpl(), InputSlot::GetConnectedOutputSlot(), Layer::GetInputSlot(), Layer::GetName(), Layer::GetOutputSlot(), InputSlot::GetOwningLayer(), OutputSlot::GetOwningLayer(), Layer::GetType(), Graph::InsertNewLayer(), Convolution2dDescriptor::m_BiasEnabled, Convolution2dDescriptor::m_DataLayout, Convolution2dDescriptor::m_PadBottom, Convolution2dDescriptor::m_PadLeft, Convolution2dDescriptor::m_PadRight, Convolution2dDescriptor::m_PadTop, OutputSlot::MoveAllConnections(), armnn::NHWC, armnn::Pad, and FoldPadIntoConvolution2dImpl::~FoldPadIntoConvolution2dImpl().

+
22  {
23  Layer& base = connection.GetConnectedOutputSlot()->GetOwningLayer();
24  Layer& child = connection.GetOwningLayer();
25 
26  ARMNN_ASSERT(base.GetType() == LayerType::Pad);
27  ARMNN_ASSERT(child.GetType() == LayerType::Convolution2d);
28 
29  PadLayer* padLayer = PolymorphicDowncast<PadLayer*>(&base);
30  Convolution2dLayer* convolution2dLayer = PolymorphicDowncast<Convolution2dLayer*>(&child);
31 
32  OutputSlot* parentOut = base.GetInputSlot(0).GetConnectedOutputSlot();
33 
34  const std::string name = std::string("folded-") + base.GetName() + std::string("-into-") + child.GetName();
35  Convolution2dDescriptor descriptor = convolution2dLayer->GetParameters();
36 
37  auto padList = padLayer->GetParameters().m_PadList;
38 
39  armnn::DataLayout dataLayout = descriptor.m_DataLayout;
40 
41  // In Convolution2dDescriptor, padLeft and padRight are defined as paddings on width dimension
42  // whereas padTop and padBottom - paddings on height dimension, so setting these according to data layout
43  if(dataLayout == armnn::DataLayout::NHWC)
44  {
45  descriptor.m_PadLeft = padList[2].first;
46  descriptor.m_PadRight = padList[2].second;
47  descriptor.m_PadTop = padList[1].first;
48  descriptor.m_PadBottom = padList[1].second;
49  }
50  else
51  {
52  descriptor.m_PadLeft = padList[3].first;
53  descriptor.m_PadRight = padList[3].second;
54  descriptor.m_PadTop = padList[2].first;
55  descriptor.m_PadBottom = padList[2].second;
56  }
57 
58  auto& newConv2dLayer = *graph.InsertNewLayer<Convolution2dLayer>(base.GetInputSlot(0),
59  descriptor,
60  name.c_str());
61 
62  // Copy weights and bias to the new convolution layer
63  ARMNN_ASSERT_MSG(convolution2dLayer->m_Weight != nullptr,
64  "FoldPadIntoConvolution2d: Weights data should not be null.");
65  newConv2dLayer.m_Weight = std::move(convolution2dLayer->m_Weight);
66  if (descriptor.m_BiasEnabled)
67  {
68  ARMNN_ASSERT_MSG(convolution2dLayer->m_Bias != nullptr,
69  "FoldPadIntoConvolution2d: Bias data should not be null if bias is enabled.");
70  newConv2dLayer.m_Bias = std::move(convolution2dLayer->m_Bias);
71  }
72 
73  // Reconnects with original parent.
74  newConv2dLayer.GetOutputSlot().MoveAllConnections(*parentOut);
75  // Parent is now the new convolution2d layer.
76  parentOut = &newConv2dLayer.GetOutputSlot();
77 
78  // Moves connections in child output to parent layer.
79  // Child layer will be removed as it's left unconnected.
80  // Base layer will be removed if left unconnected.
81  child.GetOutputSlot().MoveAllConnections(*parentOut);
82  }
DataLayout
Definition: Types.hpp:50
+ +
#define ARMNN_ASSERT_MSG(COND, MSG)
Definition: Assert.hpp:15
+ + +
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
+ +
+
+
+
The documentation for this class was generated from the following file: +
+
+ + + + -- cgit v1.2.1