ArmNN
 25.02
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RefDepthwiseConvolution2dWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017,2019,2021-2024 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 
8 #include "ConvImpl.hpp"
9 #include "RefWorkloadUtils.hpp"
10 #include "Decoders.hpp"
11 #include "Encoders.hpp"
12 #include "Profiling.hpp"
13 #include <ResolveType.hpp>
14 
15 namespace armnn
16 {
17 
19  const DepthwiseConvolution2dQueueDescriptor& descriptor, const WorkloadInfo& info)
21 {
22  WorkloadInfo detailsInfo;
23  detailsInfo.m_InputTensorInfos = info.m_InputTensorInfos;
24  detailsInfo.m_OutputTensorInfos = info.m_OutputTensorInfos;
25 
26  // Report Profiling Details
27  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("RefDepthwiseConvolution2dWorkload_Construct",
28  descriptor.m_Parameters,
29  detailsInfo,
30  this->GetGuid());
31 }
32 
34 {
36 }
37 
38 void RefDepthwiseConvolution2dWorkload::Execute(std::vector<ITensorHandle*> inputs,
39  std::vector<ITensorHandle*> outputs) const
40 {
41  ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID("RefDepthwiseConvolution2dWorkload_Execute");
42 
43  const TensorShape& inputShape = GetTensorInfo(inputs[0]).GetShape();
44  const TensorShape& outputShape = GetTensorInfo(outputs[0]).GetShape();
45  const TensorShape& filterShape = GetTensorInfo(inputs[1]).GetShape();
46 
47  std::unique_ptr<Decoder<float>> inputDecoder = MakeDecoder<float>(GetTensorInfo(inputs[0]), inputs[0]->Map());
48  std::unique_ptr<Encoder<float>> outputEncoder = MakeEncoder<float>(GetTensorInfo(outputs[0]), outputs[0]->Map());
49  std::unique_ptr<Decoder<float>> filterDecoder = MakeDecoder<float>(GetTensorInfo(inputs[1]), inputs[1]->Map());
50  std::unique_ptr<Decoder<float>> biasDecoder{};
51  if (m_Data.m_Parameters.m_BiasEnabled)
52  {
53  biasDecoder = MakeDecoder<float>(GetTensorInfo(inputs[2]), inputs[2]->Map());
54  }
55 
56  Convolve(inputShape, *inputDecoder, outputShape, *outputEncoder,
57  filterShape, *filterDecoder, m_Data.m_Parameters.m_BiasEnabled, biasDecoder.get(),
58  m_Data.m_Parameters.m_DataLayout, m_Data.m_Parameters.m_PadTop, m_Data.m_Parameters.m_PadLeft,
59  m_Data.m_Parameters.m_StrideX, m_Data.m_Parameters.m_StrideY,
60  m_Data.m_Parameters.m_DilationX,
61  m_Data.m_Parameters.m_DilationY, true);
62 }
63 
64 } //namespace armnn
#define ARMNN_REPORT_PROFILING_WORKLOAD_DESC(name, desc, infos, guid)
Definition: Profiling.hpp:227
#define ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
QueueDescriptor m_Data
Definition: Workload.hpp:74
RefDepthwiseConvolution2dWorkload(const DepthwiseConvolution2dQueueDescriptor &descriptor, const WorkloadInfo &info)
const TensorShape & GetShape() const
Definition: Tensor.hpp:193
Copyright (c) 2021 ARM Limited and Contributors.
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
void Convolve(const TensorShape &rInputShape, Decoder< float > &rInputDecoder, const TensorShape &rOutputShape, Encoder< float > &rOutputEncoder, const TensorShape &rFilterShape, Decoder< float > &rFilterDecoder, bool biasEnabled, Decoder< float > *pBiasDecoder, DataLayout dataLayout, unsigned int paddingTop, unsigned int paddingLeft, unsigned int xStride, unsigned int yStride, unsigned int xDilation, unsigned int yDilation, bool depthwise)
Definition: ConvImpl.cpp:68
Depthwise Convolution 2D layer workload data.
std::vector< ITensorHandle * > m_Inputs
std::vector< ITensorHandle * > m_Outputs
Contains information about TensorInfos of a layer.
std::vector< TensorInfo > m_OutputTensorInfos
std::vector< TensorInfo > m_InputTensorInfos