Laurent Carlier | 749294b | 2020-06-01 09:03:17 +0100 | [diff] [blame] | 1 | // |
Matthew Sloyan | 21a6a1a | 2022-06-30 17:13:04 +0100 | [diff] [blame] | 2 | // Copyright © 2022 Arm Ltd and Contributors. All rights reserved. |
Nattapat Chaimanowong | 8a54ac0 | 2019-03-29 15:25:04 +0000 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "RefDequantizeWorkload.hpp" |
| 7 | #include "RefWorkloadUtils.hpp" |
Jan Eilers | f710793 | 2019-11-01 11:09:36 +0000 | [diff] [blame] | 8 | #include "Encoders.hpp" |
| 9 | #include "Decoders.hpp" |
| 10 | #include "Dequantize.hpp" |
Nattapat Chaimanowong | 8a54ac0 | 2019-03-29 15:25:04 +0000 | [diff] [blame] | 11 | |
| 12 | namespace armnn |
| 13 | { |
| 14 | |
| 15 | void RefDequantizeWorkload::Execute() const |
| 16 | { |
Finn Williams | b8181f7 | 2021-04-07 10:23:21 +0100 | [diff] [blame] | 17 | Execute(m_Data.m_Inputs, m_Data.m_Outputs); |
| 18 | } |
| 19 | |
Matthew Sloyan | 21a6a1a | 2022-06-30 17:13:04 +0100 | [diff] [blame] | 20 | void RefDequantizeWorkload::ExecuteAsync(ExecutionData& executionData) |
Finn Williams | b8181f7 | 2021-04-07 10:23:21 +0100 | [diff] [blame] | 21 | { |
Matthew Sloyan | 21a6a1a | 2022-06-30 17:13:04 +0100 | [diff] [blame] | 22 | WorkingMemDescriptor* workingMemDescriptor = static_cast<WorkingMemDescriptor*>(executionData.m_Data); |
| 23 | Execute(workingMemDescriptor->m_Inputs, workingMemDescriptor->m_Outputs); |
Finn Williams | b8181f7 | 2021-04-07 10:23:21 +0100 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | void RefDequantizeWorkload::Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const |
| 27 | { |
Nattapat Chaimanowong | 8a54ac0 | 2019-03-29 15:25:04 +0000 | [diff] [blame] | 28 | ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefDequantizeWorkload_Execute"); |
| 29 | |
Finn Williams | b8181f7 | 2021-04-07 10:23:21 +0100 | [diff] [blame] | 30 | const TensorInfo& inputInfo = GetTensorInfo(inputs[0]); |
| 31 | const TensorInfo& outputInfo = GetTensorInfo(outputs[0]); |
Nattapat Chaimanowong | 8a54ac0 | 2019-03-29 15:25:04 +0000 | [diff] [blame] | 32 | |
Finn Williams | b8181f7 | 2021-04-07 10:23:21 +0100 | [diff] [blame] | 33 | auto inputDecoder = MakeDecoder<float>(inputInfo, inputs[0]->Map()); |
| 34 | auto outputEncoder = MakeEncoder<float>(outputInfo, outputs[0]->Map()); |
Nattapat Chaimanowong | 8a54ac0 | 2019-03-29 15:25:04 +0000 | [diff] [blame] | 35 | |
Jan Eilers | f710793 | 2019-11-01 11:09:36 +0000 | [diff] [blame] | 36 | Dequantize(*inputDecoder, *outputEncoder, inputInfo, outputInfo); |
Nattapat Chaimanowong | 8a54ac0 | 2019-03-29 15:25:04 +0000 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | } // namespace armnn |