ArmNN
 22.11
RefConvolution3dWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 
8 #include "Conv3dImpl.hpp"
9 #include "RefWorkloadUtils.hpp"
10 
11 #include "Profiling.hpp"
12 
13 namespace armnn
14 {
16  const Convolution3dQueueDescriptor& descriptor, const WorkloadInfo& info)
18 {
19  WorkloadInfo detailsInfo;
20  detailsInfo.m_InputTensorInfos = info.m_InputTensorInfos;
21  detailsInfo.m_OutputTensorInfos = info.m_OutputTensorInfos;
23  if (descriptor.m_Parameters.m_BiasEnabled)
24  {
26  }
27 
28  // Report Profiling Details
29  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("RefConvolution3dWorkload_Construct",
30  descriptor.m_Parameters,
31  detailsInfo,
32  this->GetGuid());
33 }
34 
36 {
38 }
39 
41 {
42  WorkingMemDescriptor* workingMemDescriptor = static_cast<WorkingMemDescriptor*>(executionData.m_Data);
43  Execute(workingMemDescriptor->m_Inputs, workingMemDescriptor->m_Outputs);
44 }
45 
46 void RefConvolution3dWorkload::Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const
47 {
48  ARMNN_SCOPED_PROFILING_EVENT_GUID(Compute::CpuRef, "RefConvolution3dWorkload_Execute", this->GetGuid());
49 
50  std::unique_ptr<Decoder<float>> inputDecoder = MakeDecoder<float>(GetTensorInfo(inputs[0]), inputs[0]->Map());
51  std::unique_ptr<Encoder<float>> outputEncoder = MakeEncoder<float>(GetTensorInfo(outputs[0]), outputs[0]->Map());
52 
53  const TensorShape& inputShape = GetTensorInfo(inputs[0]).GetShape();
54  const TensorShape& outputShape = GetTensorInfo(outputs[0]).GetShape();
55 
56  const auto& filterInfo = GetTensorInfo(inputs[1]);
57  std::unique_ptr<Decoder<float>> filterDecoder = MakeDecoder<float>(GetTensorInfo(inputs[1]), inputs[1]->Map());
58  std::unique_ptr<Decoder<float>> biasDecoder;
59 
61  {
62  biasDecoder = MakeDecoder<float>(GetTensorInfo(inputs[2]), inputs[2]->Map());
63  }
64 
65  Convolve3d(inputShape, *inputDecoder, outputShape, *outputEncoder, filterInfo.GetShape(),
66  *filterDecoder, m_Data.m_Parameters.m_BiasEnabled, biasDecoder.get(),
71 }
72 
73 } //namespace armnn
const TensorShape & GetShape() const
Definition: Tensor.hpp:191
CPU Execution: Reference C++ kernels.
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
arm::pipe::ProfilingGuid GetGuid() const final
Definition: Workload.hpp:61
bool m_BiasEnabled
Enable/disable bias.
Copyright (c) 2021 ARM Limited and Contributors.
uint32_t m_DilationX
Dilation along x axis.
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
std::vector< TensorInfo > m_InputTensorInfos
std::vector< TensorInfo > m_OutputTensorInfos
uint32_t m_PadFront
Padding front value in the depth dimension.
uint32_t m_PadLeft
Padding left value in the width dimension.
#define ARMNN_SCOPED_PROFILING_EVENT_GUID(backendId, name, guid)
Definition: Profiling.hpp:223
Optional< TensorInfo > m_BiasTensorInfo
DataLayout m_DataLayout
The data layout to be used (NDHWC, NCDHW).
void ExecuteAsync(ExecutionData &executionData) override
std::vector< ITensorHandle * > m_Outputs
uint32_t m_PadTop
Padding top value in the height dimension.
#define ARMNN_REPORT_PROFILING_WORKLOAD_DESC(name, desc, infos, guid)
Definition: Profiling.hpp:227
Contains information about TensorInfos of a layer.
std::vector< ITensorHandle * > m_Inputs
uint32_t m_DilationZ
Dilation along z axis.
RefConvolution3dWorkload(const Convolution3dQueueDescriptor &descriptor, const WorkloadInfo &info)
uint32_t m_StrideZ
Stride value when proceeding through input for the depth dimension.
Optional< TensorInfo > m_WeightsTensorInfo
uint32_t m_DilationY
Dilation along y axis.
void Convolve3d(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 paddingFront, unsigned int xStride, unsigned int yStride, unsigned int zStride, unsigned int xDilation, unsigned int yDilation, unsigned int zDilation)
Definition: Conv3dImpl.cpp:11
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers