Nikhil Raj | 9b46148 | 2019-07-03 15:58:31 +0100 | [diff] [blame] | 1 | // |
Teresa Charlin | 588cbdf | 2022-01-19 15:55:37 +0000 | [diff] [blame] | 2 | // Copyright © 2017 Arm Ltd and Contributors. All rights reserved. |
Nikhil Raj | 9b46148 | 2019-07-03 15:58:31 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "NeonPreluWorkload.hpp" |
| 7 | #include "NeonWorkloadUtils.hpp" |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 8 | |
Nikhil Raj | 9b46148 | 2019-07-03 15:58:31 +0100 | [diff] [blame] | 9 | #include <aclCommon/ArmComputeUtils.hpp> |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 10 | #include <armnn/utility/PolymorphicDowncast.hpp> |
Nikhil Raj | 9b46148 | 2019-07-03 15:58:31 +0100 | [diff] [blame] | 11 | |
| 12 | #include <arm_compute/runtime/NEON/functions/NEPReluLayer.h> |
| 13 | |
| 14 | namespace armnn |
| 15 | { |
| 16 | |
| 17 | arm_compute::Status NeonPreluWorkloadValidate(const TensorInfo& input, |
| 18 | const TensorInfo& alpha, |
| 19 | const TensorInfo& output) |
| 20 | { |
| 21 | const arm_compute::TensorInfo aclInput = armcomputetensorutils::BuildArmComputeTensorInfo(input); |
| 22 | const arm_compute::TensorInfo aclAlpha = armcomputetensorutils::BuildArmComputeTensorInfo(alpha); |
| 23 | const arm_compute::TensorInfo aclOutput = armcomputetensorutils::BuildArmComputeTensorInfo(output); |
| 24 | |
| 25 | return arm_compute::NEPReluLayer::validate(&aclInput, |
| 26 | &aclAlpha, |
| 27 | &aclOutput); |
| 28 | } |
| 29 | |
| 30 | NeonPreluWorkload::NeonPreluWorkload(const PreluQueueDescriptor& descriptor, |
| 31 | const WorkloadInfo& info) |
Teresa Charlin | 588cbdf | 2022-01-19 15:55:37 +0000 | [diff] [blame] | 32 | : NeonBaseWorkload<PreluQueueDescriptor>(descriptor, info) |
Nikhil Raj | 9b46148 | 2019-07-03 15:58:31 +0100 | [diff] [blame] | 33 | { |
| 34 | m_Data.ValidateInputsOutputs("NeonPreluWorkload", 1, 1); |
| 35 | |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 36 | arm_compute::ITensor& input = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 37 | arm_compute::ITensor& alpha = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[1])->GetTensor(); |
| 38 | arm_compute::ITensor& output = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
Nikhil Raj | 9b46148 | 2019-07-03 15:58:31 +0100 | [diff] [blame] | 39 | |
| 40 | auto layer = std::make_unique<arm_compute::NEPReluLayer>(); |
| 41 | layer->configure(&input, &alpha, &output); |
| 42 | |
| 43 | m_PreluLayer.reset(layer.release()); |
| 44 | } |
| 45 | |
| 46 | void NeonPreluWorkload::Execute() const |
| 47 | { |
Keith Davis | 2d0679f | 2021-08-05 11:35:00 +0100 | [diff] [blame] | 48 | ARMNN_SCOPED_PROFILING_EVENT_NEON_GUID("NeonPreluWorkload_Execute", this->GetGuid()); |
Nikhil Raj | 9b46148 | 2019-07-03 15:58:31 +0100 | [diff] [blame] | 49 | m_PreluLayer->run(); |
| 50 | } |
| 51 | |
| 52 | } //namespace armnn |