11 #include <arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadContext.h>
12 #include <arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.h>
13 #include <arm_compute/dynamic_fusion/sketch/gpu/operators/GpuConv2d.h>
14 #include <arm_compute/dynamic_fusion/sketch/gpu/operators/GpuOutput.h>
18 using namespace arm_compute::experimental::dynamic_fusion;
19 using namespace armnn::armcomputetensorutils;
30 auto compileCtx = arm_compute::CLKernelLibrary::get().get_compile_context();
31 auto workloadContext = GpuWorkloadContext(&compileCtx);
32 GpuWorkloadSketch sketch{ &workloadContext };
35 const arm_compute::TensorInfo aclInputInfo = BuildArmComputeTensorInfo(input, descriptor.
m_DataLayout);
36 arm_compute::TensorInfo aclWeightsInfo = BuildArmComputeTensorInfo(weights, descriptor.
m_DataLayout);
37 aclWeightsInfo.set_are_values_constant(weights.
IsConstant());
39 auto inputInfo = workloadContext.create_tensor_info(aclInputInfo);
40 auto weightInfo = workloadContext.create_tensor_info(aclWeightsInfo);
43 arm_compute::TensorInfo aclBiasInfo;
44 arm_compute::ITensorInfo* biasSketchInfoPtr =
nullptr;
53 aclBiasInfo.set_are_values_constant(biases.
value().IsConstant());
55 biasSketchInfoPtr = workloadContext.create_tensor_info(aclBiasInfo);
87 GpuWorkloadSketch* sketch = blob->
sketch.get();
89 std::vector<arm_compute::ITensorInfo*> inputTensorInfos = {};
90 std::vector<arm_compute::ITensorInfo*> outputTensorInfos = {};
93 const arm_compute::TensorInfo aclInputInfo = BuildArmComputeTensorInfo(input, descriptor.
m_DataLayout);
94 arm_compute::TensorInfo aclWeightsInfo = BuildArmComputeTensorInfo(weights, descriptor.
m_DataLayout);
95 aclWeightsInfo.set_are_values_constant(weights.
IsConstant());
97 inputTensorInfos.emplace_back(workloadContext->create_tensor_info(aclInputInfo));
98 inputTensorInfos.emplace_back(workloadContext->create_tensor_info(aclWeightsInfo));
101 arm_compute::TensorInfo aclBiasInfo;
102 arm_compute::ITensorInfo* biasSketchInfoPtr =
nullptr;
110 aclBiasInfo = BuildArmComputeTensorInfo(biases.
value(), descriptor.
m_DataLayout);
111 aclBiasInfo.set_are_values_constant(biases.
value().IsConstant());
113 inputTensorInfos.emplace_back(workloadContext->create_tensor_info(aclBiasInfo));
114 biasSketchInfoPtr = inputTensorInfos[2];
126 const bool supported = (aclStatus.error_code() == arm_compute::ErrorCode::OK);
133 arm_compute::ITensorInfo* convOutInfo = GpuConv2d::create_op(*sketch,
140 outputTensorInfos.emplace_back(workloadContext->create_tensor_info());
141 GpuOutput::create_op(*sketch, convOutInfo, outputTensorInfos[0]);
144 blob->
inputTensorInfos = std::make_unique<std::vector<arm_compute::ITensorInfo*>>(inputTensorInfos);
145 blob->
outputTensorInfos = std::make_unique<std::vector<arm_compute::ITensorInfo*>>(outputTensorInfos);