Matteo Martincigh | ab9e525 | 2019-06-13 17:27:46 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 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) |
| 18 | : BaseWorkload(descriptor, info) |
| 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 | |
| 26 | void RefPreluWorkload::ExecuteAsync(WorkingMemDescriptor &workingMemDescriptor) |
| 27 | { |
| 28 | Execute(workingMemDescriptor.m_Inputs, workingMemDescriptor.m_Outputs); |
| 29 | } |
| 30 | |
| 31 | void RefPreluWorkload::Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const |
| 32 | { |
Matteo Martincigh | ab9e525 | 2019-06-13 17:27:46 +0100 | [diff] [blame] | 33 | ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefPreluWorkload_Execute"); |
| 34 | |
Finn Williams | 0109794 | 2021-04-26 12:06:34 +0100 | [diff] [blame] | 35 | const TensorInfo& inputInfo = GetTensorInfo(inputs[0]); |
| 36 | const TensorInfo& alphaInfo = GetTensorInfo(inputs[1]); |
| 37 | const TensorInfo& outputInfo = GetTensorInfo(outputs[0]); |
| 38 | |
Finn Williams | b8181f7 | 2021-04-07 10:23:21 +0100 | [diff] [blame] | 39 | std::unique_ptr<Decoder<float>> inputDecoder = MakeDecoder<float>(GetTensorInfo(inputs[0]), |
| 40 | inputs[0]->Map()); |
| 41 | std::unique_ptr<Decoder<float>> alphaDecoder = MakeDecoder<float>(GetTensorInfo(inputs[1]), |
| 42 | inputs[1]->Map()); |
| 43 | std::unique_ptr<Encoder<float>> outputEncoder = MakeEncoder<float>(GetTensorInfo(outputs[0]), |
| 44 | outputs[0]->Map()); |
Matteo Martincigh | ab9e525 | 2019-06-13 17:27:46 +0100 | [diff] [blame] | 45 | |
Finn Williams | 0109794 | 2021-04-26 12:06:34 +0100 | [diff] [blame] | 46 | PreluImpl(inputInfo, alphaInfo, outputInfo, *inputDecoder, *alphaDecoder, *outputEncoder); |
Matteo Martincigh | ab9e525 | 2019-06-13 17:27:46 +0100 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | } // namespace armnn |