19 #include <arm_compute/runtime/NEON/functions/NEDepthwiseConvolutionLayer.h> 26 using namespace armcomputetensorutils;
34 const arm_compute::TensorInfo aclInputInfo = BuildArmComputeTensorInfo(input, descriptor.
m_DataLayout);
35 const arm_compute::TensorInfo aclOutputInfo = BuildArmComputeTensorInfo(output, descriptor.
m_DataLayout);
38 const unsigned int aclDepthMultiplier = weights.
GetShape()[0];
45 const arm_compute::TensorInfo aclWeightsInfo = BuildArmComputeTensorInfo(weightsPermuted, descriptor.
m_DataLayout);
47 arm_compute::TensorInfo aclBiasesInfo;
48 arm_compute::TensorInfo *optionalAclBiasesInfo =
nullptr;
54 aclBiasesInfo = BuildArmComputeTensorInfo(biases.
value(), descriptor.
m_DataLayout);
55 optionalAclBiasesInfo = &aclBiasesInfo;
58 arm_compute::PadStrideInfo aclPadStrideInfo = BuildArmComputePadStrideInfo(descriptor);
59 const arm_compute::Size2D aclDilationInfo = BuildArmComputeSize2D(
62 return arm_compute::NEDepthwiseConvolutionLayer::validate(&aclInputInfo,
64 optionalAclBiasesInfo,
68 arm_compute::ActivationLayerInfo(),
90 m_KernelTensor = std::make_unique<arm_compute::Tensor>();
95 m_BiasTensor = std::make_unique<arm_compute::Tensor>();
99 const arm_compute::Size2D aclDilationInfo = BuildArmComputeSize2D(
107 arm_compute::ITensor& input = inputTensorHandle->
GetTensor();
108 arm_compute::ITensor& output = outputTensorHandle->
GetTensor();
111 input.info()->set_data_layout(aclDataLayout);
112 output.info()->set_data_layout(aclDataLayout);
115 const unsigned int depthMultiplier = weightInfo.GetShape()[0];
117 arm_compute::PadStrideInfo padStrideInfo = BuildArmComputePadStrideInfo(
m_Data.
m_Parameters);
119 m_pDepthwiseConvolutionLayer = std::make_unique<arm_compute::NEDepthwiseConvolutionLayer>();
120 static_cast<arm_compute::NEDepthwiseConvolutionLayer*
>(
121 m_pDepthwiseConvolutionLayer.get())->configure(&input,
122 m_KernelTensor.get(),
127 arm_compute::ActivationLayerInfo(),
130 BOOST_ASSERT(m_pDepthwiseConvolutionLayer);
140 m_pDepthwiseConvolutionLayer->prepare();
147 BOOST_ASSERT(m_pDepthwiseConvolutionLayer);
149 m_pDepthwiseConvolutionLayer->run();
152 void NeonDepthwiseConvolutionWorkload::FreeUnusedTensors()
154 FreeTensorIfUnused(m_KernelTensor);
155 FreeTensorIfUnused(m_BiasTensor);
const TensorInfo & GetTensorInfo() const
uint32_t m_DilationX
Dilation factor value for width dimension.
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
#define ARMNN_SCOPED_PROFILING_EVENT_NEON(name)
armnn::ConstTensor ConvertWeightTensorFromArmnnToAcl(const ConstCpuTensorHandle *weightTensor, DataLayout dataLayout, void *permuteBuffer)
LayerDescriptor m_Parameters
const ConstCpuTensorHandle * m_Bias
arm_compute::Status NeonDepthwiseConvolutionWorkloadValidate(const TensorInfo &input, const TensorInfo &output, const DepthwiseConvolution2dDescriptor &descriptor, const TensorInfo &weights, const Optional< TensorInfo > &biases)
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
virtual void Execute() const override
const ConstCpuTensorHandle * m_Weight
unsigned int GetNumBytes() const
const DepthwiseConvolution2dQueueDescriptor m_Data
NeonDepthwiseConvolutionWorkload(const DepthwiseConvolution2dQueueDescriptor &descriptor, const WorkloadInfo &info)
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
virtual arm_compute::ITensor & GetTensor()=0
bool m_BiasEnabled
Enable/disable bias.
std::vector< ITensorHandle * > m_Outputs
std::vector< ITensorHandle * > m_Inputs
A DepthwiseConvolution2dDescriptor for the DepthwiseConvolution2dLayer.
const TensorShape & GetShape() const
bool has_value() const noexcept
TensorInfo ConvertWeightTensorInfoFromArmnnToAcl(const TensorInfo &weightInfo, DataLayout dataLayout)
void InitializeArmComputeTensorData(arm_compute::Tensor &tensor, const ConstCpuTensorHandle *handle)
uint32_t m_DilationY
Dilation factor value for height dimension.