Tianle Cheng | 988354d | 2023-06-28 13:20:47 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2023 Arm Ltd and Contributors. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "RefReverseV2Workload.hpp" |
| 7 | |
| 8 | #include "ReverseV2Impl.hpp" |
| 9 | #include "RefWorkloadUtils.hpp" |
| 10 | #include "Profiling.hpp" |
| 11 | |
| 12 | namespace armnn |
| 13 | { |
| 14 | |
| 15 | RefReverseV2Workload::RefReverseV2Workload(const ReverseV2QueueDescriptor& descriptor, const WorkloadInfo& info) |
| 16 | : RefBaseWorkload(descriptor, info) |
| 17 | {} |
| 18 | |
| 19 | void RefReverseV2Workload::Execute() const |
| 20 | { |
| 21 | Execute(m_Data.m_Inputs, m_Data.m_Outputs); |
| 22 | } |
| 23 | |
| 24 | void RefReverseV2Workload::ExecuteAsync(ExecutionData& executionData) |
| 25 | { |
| 26 | WorkingMemDescriptor* workingMemDescriptor = static_cast<WorkingMemDescriptor*>(executionData.m_Data); |
| 27 | Execute(workingMemDescriptor->m_Inputs, workingMemDescriptor->m_Outputs); |
| 28 | } |
| 29 | |
| 30 | void RefReverseV2Workload::Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const |
| 31 | { |
Mike Kelly | 7cbe781 | 2023-07-25 17:37:33 +0100 | [diff] [blame] | 32 | ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID("RefReverseV2Workload_Execute"); |
Tianle Cheng | 988354d | 2023-06-28 13:20:47 +0100 | [diff] [blame] | 33 | |
| 34 | const TensorInfo& inputInfo = GetTensorInfo(inputs[0]); |
Tracy Narine | bb8d759 | 2023-07-13 16:50:54 +0100 | [diff] [blame] | 35 | const TensorInfo& axisInfo = GetTensorInfo(inputs[1]); |
Tianle Cheng | 988354d | 2023-06-28 13:20:47 +0100 | [diff] [blame] | 36 | |
| 37 | std::unique_ptr<Decoder<float>> inputDecoder = MakeDecoder<float>(GetTensorInfo(inputs[0]), |
| 38 | inputs[0]->Map()); |
| 39 | |
Tracy Narine | bb8d759 | 2023-07-13 16:50:54 +0100 | [diff] [blame] | 40 | std::unique_ptr<Decoder<int>> axisDecoder = MakeDecoder<int>(GetTensorInfo(inputs[1]), |
Tianle Cheng | 21a9f33 | 2023-11-09 13:56:53 +0000 | [diff] [blame] | 41 | inputs[1]->Map()); |
Tracy Narine | bb8d759 | 2023-07-13 16:50:54 +0100 | [diff] [blame] | 42 | |
Tianle Cheng | 988354d | 2023-06-28 13:20:47 +0100 | [diff] [blame] | 43 | std::unique_ptr<Encoder<float>> outputEncoder = MakeEncoder<float>(GetTensorInfo(outputs[0]), |
| 44 | outputs[0]->Map()); |
| 45 | |
Tracy Narine | bb8d759 | 2023-07-13 16:50:54 +0100 | [diff] [blame] | 46 | ReverseV2(inputInfo, |
| 47 | axisInfo, |
Tianle Cheng | 988354d | 2023-06-28 13:20:47 +0100 | [diff] [blame] | 48 | *inputDecoder, |
Tracy Narine | bb8d759 | 2023-07-13 16:50:54 +0100 | [diff] [blame] | 49 | *axisDecoder, |
Tianle Cheng | 988354d | 2023-06-28 13:20:47 +0100 | [diff] [blame] | 50 | *outputEncoder); |
| 51 | } |
| 52 | |
| 53 | } // namespace armnn |