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 m_BiasProxy = std::make_unique<ICLTensorProxy>(&bias);
107 m_InputProxy = std::make_unique<ICLTensorProxy>(&input);
108 m_OutputProxy = std::make_unique<ICLTensorProxy>(&output);
109 m_WeightsProxy = std::make_unique<ICLTensorProxy>(&weights);
112 input.info()->set_data_layout(aclDataLayout);
113 output.info()->set_data_layout(aclDataLayout);
114 weights.info()->set_data_layout(aclDataLayout);
116 arm_compute::PadStrideInfo padStrideInfo = BuildArmComputePadStrideInfo(
m_Data.
m_Parameters);
122 m_ConvolutionLayer.configure(clCompileContext,
124 m_WeightsProxy.get(),
128 arm_compute::WeightsInfo(),
134 m_ConvolutionMethod =
135 m_ConvolutionLayer.get_convolution_method(input.info(),
139 arm_compute::WeightsInfo(),
141 arm_compute::CLScheduler::get().target(),
167 return m_ConvolutionMethod;
175 m_InputProxy->set(&input);
176 m_OutputProxy->set(&output);