20 #include <arm_compute/runtime/NEON/functions/NEDepthwiseConvolutionLayer.h>
27 using namespace armcomputetensorutils;
36 const arm_compute::TensorInfo aclInputInfo = BuildArmComputeTensorInfo(input, descriptor.
m_DataLayout);
37 const arm_compute::TensorInfo aclOutputInfo = BuildArmComputeTensorInfo(output, descriptor.
m_DataLayout);
48 unsigned int aclDepthMultiplier;
53 arm_compute::TensorInfo aclWeightsInfo = BuildArmComputeTensorInfo(weightsPermuted, descriptor.
m_DataLayout);
54 aclWeightsInfo.set_are_values_constant(weights.
IsConstant());
56 arm_compute::TensorInfo aclBiasesInfo;
57 arm_compute::TensorInfo* optionalAclBiasesInfo =
nullptr;
63 "ArmNN NeonDepthwiseConvolutionWorkload has empty bias value."};
65 aclBiasesInfo = BuildArmComputeTensorInfo(biases.
value(), descriptor.
m_DataLayout);
67 optionalAclBiasesInfo = &aclBiasesInfo;
70 const arm_compute::PadStrideInfo aclPadStrideInfo = BuildArmComputePadStrideInfo(descriptor);
71 const arm_compute::Size2D aclDilationInfo = BuildArmComputeSize2D(descriptor.
m_DilationX,
75 activationDescriptor);
77 return arm_compute::NEDepthwiseConvolutionLayer::validate(&aclInputInfo,
79 optionalAclBiasesInfo,
92 arm_compute::ITensor& input = PolymorphicDowncast<IAclTensorHandle*>(
m_Data.
m_Inputs[0])->GetTensor();
93 arm_compute::ITensor& output = PolymorphicDowncast<IAclTensorHandle*>(
m_Data.
m_Outputs[0])->GetTensor();
94 arm_compute::ITensor& weights = PolymorphicDowncast<IAclTensorHandle*>(
m_Data.
m_Inputs[1])->GetTensor();
95 weights.info()->set_are_values_constant(
info.m_InputTensorInfos[1].IsConstant());
96 arm_compute::ITensor* biasesPtr =
nullptr;
99 biasesPtr = &PolymorphicDowncast<IAclTensorHandle *>(
m_Data.
m_Inputs[2])->GetTensor();
100 biasesPtr->info()->set_are_values_constant(
info.m_InputTensorInfos[2].IsConstant());
103 arm_compute::TensorShape weightsShape = weights.info()->tensor_shape();
104 arm_compute::TensorShape inputShape = input.info()->tensor_shape();
108 unsigned int depthMultiplier =
118 input.info()->set_data_layout(aclDataLayout);
119 weights.info()->set_data_layout(aclDataLayout);
120 output.info()->set_data_layout(aclDataLayout);
122 const arm_compute::PadStrideInfo padStrideInfo = BuildArmComputePadStrideInfo(
m_Data.
m_Parameters);
126 m_pDepthwiseConvolutionLayer = std::make_unique<arm_compute::NEDepthwiseConvolutionLayer>();
127 static_cast<arm_compute::NEDepthwiseConvolutionLayer*
>(
128 m_pDepthwiseConvolutionLayer.get())->configure(&input,
149 m_pDepthwiseConvolutionLayer->prepare();
156 m_pDepthwiseConvolutionLayer->run();