17 #include <arm_compute/runtime/CL/functions/CLConvolutionLayer.h>
21 using namespace armcomputetensorutils;
28 bool isFastMathEnabled,
31 const arm_compute::TensorInfo aclInputInfo = BuildArmComputeTensorInfo(input, descriptor.
m_DataLayout);
32 const arm_compute::TensorInfo aclOutputInfo = BuildArmComputeTensorInfo(output, descriptor.
m_DataLayout);
33 arm_compute::TensorInfo aclWeightsInfo = BuildArmComputeTensorInfo(weights, descriptor.
m_DataLayout);
34 aclWeightsInfo.set_are_values_constant(weights.
IsConstant());
36 const arm_compute::Size2D aclDilationInfo = BuildArmComputeSize2D(descriptor.
m_DilationX,
39 arm_compute::TensorInfo aclBiasesInfo;
40 arm_compute::TensorInfo *optionalAclBiasesInfo =
nullptr;
47 "ArmNN ClConvolution2dWorkload has empty bias value."};
50 if (!biases.
value().IsConstant())
53 "ArmNN ClDepthwiseConv2dWorkload does not support non constant bias."};
55 aclBiasesInfo = BuildArmComputeTensorInfo(biases.
value(), descriptor.
m_DataLayout);
56 aclBiasesInfo.set_are_values_constant(biases.
value().IsConstant());
57 optionalAclBiasesInfo = &aclBiasesInfo;
60 arm_compute::PadStrideInfo layerInfo = BuildArmComputePadStrideInfo(descriptor);
63 activationDescriptor);
65 return arm_compute::CLConvolutionLayer::validate(&aclInputInfo,
67 optionalAclBiasesInfo,
70 arm_compute::WeightsInfo(),
78 std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager,
79 const arm_compute::CLCompileContext& clCompileContext,
80 const bool isFastMathEnabled)
82 , m_ConvolutionLayer(memoryManager)
95 weights.info()->set_are_values_constant(
info.m_InputTensorInfos[1].IsConstant());
100 bias.info()->set_are_values_constant(
info.m_InputTensorInfos[2].IsConstant());
103 "The bias tensor must be constant.");
104 m_BiasProxy = std::make_unique<ICLTensorProxy>(&bias);
108 m_InputProxy = std::make_unique<ICLTensorProxy>(&input);
109 m_OutputProxy = std::make_unique<ICLTensorProxy>(&output);
110 m_WeightsProxy = std::make_unique<ICLTensorProxy>(&weights);
113 input.info()->set_data_layout(aclDataLayout);
114 output.info()->set_data_layout(aclDataLayout);
115 weights.info()->set_data_layout(aclDataLayout);
117 arm_compute::PadStrideInfo padStrideInfo = BuildArmComputePadStrideInfo(
m_Data.
m_Parameters);
123 m_ConvolutionLayer.configure(clCompileContext,
125 m_WeightsProxy.get(),
129 arm_compute::WeightsInfo(),
135 m_ConvolutionMethod =
136 m_ConvolutionLayer.get_convolution_method(input.info(),
140 arm_compute::WeightsInfo(),
142 arm_compute::CLScheduler::get().target(),
168 return m_ConvolutionMethod;
176 m_InputProxy->set(&input);
177 m_OutputProxy->set(&output);