xref: /aosp_15_r20/external/armnn/src/backends/reference/workloads/RefBaseWorkload.hpp (revision 89c4ff92f2867872bb9e2354d150bf0c8c502810)
1 //
2 // Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include <armnn/backends/Workload.hpp>
9 
10 namespace armnn
11 {
12     template <typename QueueDescriptor>
13     class RefBaseWorkload : public BaseWorkload<QueueDescriptor>
14     {
15     public:
RefBaseWorkload(const QueueDescriptor & descriptor,const WorkloadInfo & info)16         RefBaseWorkload(const QueueDescriptor& descriptor, const WorkloadInfo& info)
17                 : BaseWorkload<QueueDescriptor>(descriptor, info)
18         {}
19 
SupportsTensorHandleReplacement() const20         virtual bool SupportsTensorHandleReplacement()  const override
21         {
22             return true;
23         }
24         // Replace input tensor handle with the given TensorHandle
ReplaceInputTensorHandle(ITensorHandle * tensorHandle,unsigned int slot)25         void ReplaceInputTensorHandle(ITensorHandle* tensorHandle, unsigned int slot) override
26         {
27             this->m_Data.m_Inputs[slot] = tensorHandle;
28         }
29 
30         // Replace output tensor handle with the given TensorHandle
ReplaceOutputTensorHandle(ITensorHandle * tensorHandle,unsigned int slot)31         void ReplaceOutputTensorHandle(ITensorHandle* tensorHandle, unsigned int slot) override
32         {
33             this->m_Data.m_Outputs[slot] = tensorHandle;
34         }
35     };
36 } //namespace armnn