Matteo Martincigh | ab9e525 | 2019-06-13 17:27:46 +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. |
Matteo Martincigh | ab9e525 | 2019-06-13 17:27:46 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "RefPreluWorkload.hpp" |
| 7 | |
| 8 | #include "RefWorkloadUtils.hpp" |
| 9 | #include "PreluImpl.hpp" |
| 10 | |
| 11 | #include <Profiling.hpp> |
| 12 | |
| 13 | namespace armnn |
| 14 | { |
| 15 | |
| 16 | RefPreluWorkload::RefPreluWorkload(const PreluQueueDescriptor& descriptor, |
| 17 | const WorkloadInfo& info) |
Finn Williams | 73c547d | 2022-02-15 20:47:34 +0000 | [diff] [blame] | 18 | : RefBaseWorkload(descriptor, info) |
Matteo Martincigh | ab9e525 | 2019-06-13 17:27:46 +0100 | [diff] [blame] | 19 | {} |
| 20 | |
| 21 | void RefPreluWorkload::Execute() const |
| 22 | { |
Finn Williams | b8181f7 | 2021-04-07 10:23:21 +0100 | [diff] [blame] | 23 | Execute(m_Data.m_Inputs, m_Data.m_Outputs); |
| 24 | } |
| 25 | |
Matthew Sloyan | 21a6a1a | 2022-06-30 17:13:04 +0100 | [diff] [blame] | 26 | void RefPreluWorkload::ExecuteAsync(ExecutionData& executionData) |
Finn Williams | b8181f7 | 2021-04-07 10:23:21 +0100 | [diff] [blame] | 27 | { |
Matthew Sloyan | 21a6a1a | 2022-06-30 17:13:04 +0100 | [diff] [blame] | 28 | WorkingMemDescriptor* workingMemDescriptor = static_cast<WorkingMemDescriptor*>(executionData.m_Data); |
| 29 | Execute(workingMemDescriptor->m_Inputs, workingMemDescriptor->m_Outputs); |
Finn Williams | b8181f7 | 2021-04-07 10:23:21 +0100 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | void RefPreluWorkload::Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const |
| 33 | { |
Matteo Martincigh | ab9e525 | 2019-06-13 17:27:46 +0100 | [diff] [blame] | 34 | ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefPreluWorkload_Execute"); |
| 35 | |
Finn Williams | 0109794 | 2021-04-26 12:06:34 +0100 | [diff] [blame] | 36 | const TensorInfo& inputInfo = GetTensorInfo(inputs[0]); |
| 37 | const TensorInfo& alphaInfo = GetTensorInfo(inputs[1]); |
| 38 | const TensorInfo& outputInfo = GetTensorInfo(outputs[0]); |
| 39 | |
Finn Williams | b8181f7 | 2021-04-07 10:23:21 +0100 | [diff] [blame] | 40 | std::unique_ptr<Decoder<float>> inputDecoder = MakeDecoder<float>(GetTensorInfo(inputs[0]), |
| 41 | inputs[0]->Map()); |
| 42 | std::unique_ptr<Decoder<float>> alphaDecoder = MakeDecoder<float>(GetTensorInfo(inputs[1]), |
| 43 | inputs[1]->Map()); |
| 44 | std::unique_ptr<Encoder<float>> outputEncoder = MakeEncoder<float>(GetTensorInfo(outputs[0]), |
| 45 | outputs[0]->Map()); |
Matteo Martincigh | ab9e525 | 2019-06-13 17:27:46 +0100 | [diff] [blame] | 46 | |
Finn Williams | 0109794 | 2021-04-26 12:06:34 +0100 | [diff] [blame] | 47 | PreluImpl(inputInfo, alphaInfo, outputInfo, *inputDecoder, *alphaDecoder, *outputEncoder); |
Matteo Martincigh | ab9e525 | 2019-06-13 17:27:46 +0100 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | } // namespace armnn |