13 #include <arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadContext.h>
14 #include <arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.h>
15 #include <arm_compute/dynamic_fusion/sketch/gpu/operators/GpuDepthwiseConv2d.h>
16 #include <arm_compute/dynamic_fusion/sketch/gpu/operators/GpuOutput.h>
20 using namespace arm_compute::experimental::dynamic_fusion;
21 using namespace armnn::armcomputetensorutils;
32 auto compileCtx = arm_compute::CLKernelLibrary::get().get_compile_context();
33 auto workloadContext = GpuWorkloadContext(&compileCtx);
34 GpuWorkloadSketch sketch{ &workloadContext };
37 const arm_compute::TensorInfo aclInputInfo = BuildArmComputeTensorInfo(input, descriptor.
m_DataLayout);
48 unsigned int aclDepthMultiplier;
51 auto weightsShape = weightsPermuted.
GetShape();
52 weightsPermuted.
SetShape({weightsShape[1], weightsShape[2], weightsShape[3]});
54 arm_compute::TensorInfo aclWeightsInfo = BuildArmComputeTensorInfo(weightsPermuted, descriptor.
m_DataLayout);
55 aclWeightsInfo.set_are_values_constant(weights.
IsConstant());
57 auto inputInfo = workloadContext.create_tensor_info(aclInputInfo);
58 auto weightInfo = workloadContext.create_tensor_info(aclWeightsInfo);
61 arm_compute::TensorInfo aclBiasInfo;
62 arm_compute::ITensorInfo* biasSketchInfoPtr =
nullptr;
69 "GpuFsaDepthwiseConvolution2dValidate: No biases set when biases are enabled");
72 aclBiasInfo.set_are_values_constant(biases.
value().IsConstant());
74 biasSketchInfoPtr = workloadContext.create_tensor_info(aclBiasInfo);
84 depthwiseConv2dAttributes);
106 GpuWorkloadSketch* sketch = blob->
sketch.get();
108 std::vector<arm_compute::ITensorInfo*> inputTensorInfos = {};
109 std::vector<arm_compute::ITensorInfo*> outputTensorInfos = {};
112 const arm_compute::TensorInfo aclInputInfo = BuildArmComputeTensorInfo(input, descriptor.
m_DataLayout);
123 unsigned int aclDepthMultiplier;
126 auto weightsShape = weightsPermuted.
GetShape();
127 weightsPermuted.
SetShape({weightsShape[1], weightsShape[2], weightsShape[3]});
129 arm_compute::TensorInfo aclWeightsInfo = BuildArmComputeTensorInfo(weightsPermuted, descriptor.
m_DataLayout);
130 aclWeightsInfo.set_are_values_constant(weights.
IsConstant());
132 inputTensorInfos.emplace_back(workloadContext->create_tensor_info(aclInputInfo));
133 inputTensorInfos.emplace_back(workloadContext->create_tensor_info(aclWeightsInfo));
136 arm_compute::TensorInfo aclBiasInfo;
137 arm_compute::ITensorInfo* biasSketchInfoPtr =
nullptr;
145 aclBiasInfo = BuildArmComputeTensorInfo(biases.
value(), descriptor.
m_DataLayout);
146 aclBiasInfo.set_are_values_constant(biases.
value().IsConstant());
148 inputTensorInfos.emplace_back(workloadContext->create_tensor_info(aclBiasInfo));
149 biasSketchInfoPtr = inputTensorInfos[2];
159 depthwiseConv2dAttributes);
161 const bool supported = (aclStatus.error_code() == arm_compute::ErrorCode::OK);
165 "\"GpuFsa\" backend failed during DepthwiseConvolution2D operation validation");
169 arm_compute::ITensorInfo* convOutInfo = GpuDepthwiseConv2d::create_op(*sketch,
173 depthwiseConv2dAttributes);
175 outputTensorInfos.emplace_back(workloadContext->create_tensor_info());
176 GpuOutput::create_op(*sketch, convOutInfo, outputTensorInfos[0]);
179 blob->
inputTensorInfos = std::make_unique<std::vector<arm_compute::ITensorInfo*>>(inputTensorInfos);
180 blob->
outputTensorInfos = std::make_unique<std::vector<arm_compute::ITensorInfo*>>(outputTensorInfos);