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 --- ...ions_1_1_fold_pad_into_convolution2d_impl.xhtml | 238 +++++++++++++++++++++ 1 file changed, 238 insertions(+) create mode 100644 20.02/classarmnn_1_1optimizations_1_1_fold_pad_into_convolution2d_impl.xhtml (limited to '20.02/classarmnn_1_1optimizations_1_1_fold_pad_into_convolution2d_impl.xhtml') diff --git a/20.02/classarmnn_1_1optimizations_1_1_fold_pad_into_convolution2d_impl.xhtml b/20.02/classarmnn_1_1optimizations_1_1_fold_pad_into_convolution2d_impl.xhtml new file mode 100644 index 0000000000..71096ca08d --- /dev/null +++ b/20.02/classarmnn_1_1optimizations_1_1_fold_pad_into_convolution2d_impl.xhtml @@ -0,0 +1,238 @@ + + + + + + + + + + + + + +ArmNN: FoldPadIntoConvolution2dImpl Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  20.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 15 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 19 of file FoldPadIntoConvolution2d.hpp.

+ +

References armnn::Convolution2d, FoldPadIntoConvolution2dImpl::FoldPadIntoConvolution2dImpl(), InputSlot::GetConnectedOutputSlot(), Layer::GetInputSlot(), Layer::GetName(), Layer::GetOutputHandler(), Layer::GetOutputSlot(), InputSlot::GetOwningLayer(), OutputSlot::GetOwningLayer(), OutputHandler::GetTensorInfo(), 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, OutputHandler::SetTensorInfo(), and FoldPadIntoConvolution2dImpl::~FoldPadIntoConvolution2dImpl().

+
20  {
21  Layer& base = connection.GetConnectedOutputSlot()->GetOwningLayer();
22  Layer& child = connection.GetOwningLayer();
23 
24  BOOST_ASSERT(base.GetType() == LayerType::Pad);
25  BOOST_ASSERT(child.GetType() == LayerType::Convolution2d);
26 
27  PadLayer* padLayer = boost::polymorphic_downcast<PadLayer*>(&base);
28  Convolution2dLayer* convolution2dLayer = boost::polymorphic_downcast<Convolution2dLayer*>(&child);
29 
30  OutputSlot* parentOut = base.GetInputSlot(0).GetConnectedOutputSlot();
31  const TensorInfo& outInfo = child.GetOutputHandler().GetTensorInfo();
32 
33  const std::string name = std::string("folded-") + base.GetName() + std::string("-into-") + child.GetName();
34  Convolution2dDescriptor descriptor = convolution2dLayer->GetParameters();
35 
36  auto padList = padLayer->GetParameters().m_PadList;
37 
38  armnn::DataLayout dataLayout = descriptor.m_DataLayout;
39 
40  // In Convolution2dDescriptor, padLeft and padRight are defined as paddings on width dimension
41  // whereas padTop and padBottom - paddings on height dimension, so setting these according to data layout
42  if(dataLayout == armnn::DataLayout::NHWC)
43  {
44  descriptor.m_PadLeft = padList[2].first;
45  descriptor.m_PadRight = padList[2].second;
46  descriptor.m_PadTop = padList[1].first;
47  descriptor.m_PadBottom = padList[1].second;
48  }
49  else
50  {
51  descriptor.m_PadLeft = padList[3].first;
52  descriptor.m_PadRight = padList[3].second;
53  descriptor.m_PadTop = padList[2].first;
54  descriptor.m_PadBottom = padList[2].second;
55  }
56 
57  auto& newConv2dLayer = *graph.InsertNewLayer<Convolution2dLayer>(base.GetInputSlot(0),
58  descriptor,
59  name.c_str());
60  newConv2dLayer.GetOutputHandler().SetTensorInfo(outInfo);
61 
62  // Copy weights and bias to the new convolution layer
63  BOOST_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  BOOST_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:49
+ + + +
+
+
+
The documentation for this class was generated from the following file: +
+
+ + + + -- cgit v1.2.1