arovir01 | 9e53a35 | 2018-08-31 15:26:35 +0100 | [diff] [blame] | 1 | // |
Mike Kelly | 7cbe781 | 2023-07-25 17:37:33 +0100 | [diff] [blame] | 2 | // Copyright © 2017-2023 Arm Ltd and Contributors. All rights reserved. |
David Beck | ecb56cd | 2018-09-05 12:52:57 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
arovir01 | 9e53a35 | 2018-08-31 15:26:35 +0100 | [diff] [blame] | 4 | // |
| 5 | |
| 6 | #include "NeonFloorFloatWorkload.hpp" |
| 7 | |
Matthew Bentham | d80a712 | 2019-01-08 17:52:37 +0000 | [diff] [blame] | 8 | #include "NeonWorkloadUtils.hpp" |
| 9 | |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 10 | #include <armnn/utility/PolymorphicDowncast.hpp> |
Matthew Bentham | d80a712 | 2019-01-08 17:52:37 +0000 | [diff] [blame] | 11 | |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 12 | #include <arm_compute/runtime/NEON/functions/NEFloor.h> |
Matthew Bentham | d80a712 | 2019-01-08 17:52:37 +0000 | [diff] [blame] | 13 | |
arovir01 | 9e53a35 | 2018-08-31 15:26:35 +0100 | [diff] [blame] | 14 | namespace armnn |
| 15 | { |
| 16 | NeonFloorFloatWorkload::NeonFloorFloatWorkload(const FloorQueueDescriptor& descriptor, |
| 17 | const WorkloadInfo& info) |
| 18 | : FloatWorkload<FloorQueueDescriptor>(descriptor, info) |
| 19 | { |
| 20 | m_Data.ValidateInputsOutputs("NeonFloorFloatWorkload", 1, 1); |
| 21 | |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 22 | arm_compute::ITensor& input = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 23 | arm_compute::ITensor& output = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
arovir01 | 9e53a35 | 2018-08-31 15:26:35 +0100 | [diff] [blame] | 24 | |
Matthew Bentham | d80a712 | 2019-01-08 17:52:37 +0000 | [diff] [blame] | 25 | auto layer = std::make_unique<arm_compute::NEFloor>(); |
| 26 | layer->configure(&input, &output); |
| 27 | m_Layer.reset(layer.release()); |
arovir01 | 9e53a35 | 2018-08-31 15:26:35 +0100 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | void NeonFloorFloatWorkload::Execute() const |
| 31 | { |
Mike Kelly | 7cbe781 | 2023-07-25 17:37:33 +0100 | [diff] [blame] | 32 | ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID("NeonFloorFloatWorkload_Execute"); |
Matthew Bentham | d80a712 | 2019-01-08 17:52:37 +0000 | [diff] [blame] | 33 | m_Layer->run(); |
arovir01 | 9e53a35 | 2018-08-31 15:26:35 +0100 | [diff] [blame] | 34 | } |
David Monahan | ec81999 | 2022-02-10 14:47:13 +0000 | [diff] [blame] | 35 | |
| 36 | void NeonFloorFloatWorkload::ReplaceInputTensorHandle(ITensorHandle* tensorHandle, unsigned int slot) |
| 37 | { |
| 38 | ITensorHandle* backupHandle = this->m_Data.m_Inputs[slot]; |
| 39 | this->m_Data.m_Inputs[slot] = tensorHandle; |
| 40 | try |
| 41 | { |
| 42 | Reconfigure(); |
| 43 | } |
| 44 | catch(armnn::UnimplementedException& e) |
| 45 | { |
| 46 | // Cannot reconfigure, revert the slot back and throw the exception. |
| 47 | this->m_Data.m_Inputs[slot] = backupHandle; |
| 48 | throw e; |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | // Replace output tensor handle with the given TensorHandle |
| 53 | void NeonFloorFloatWorkload::ReplaceOutputTensorHandle(ITensorHandle* tensorHandle, unsigned int slot) |
| 54 | { |
| 55 | ITensorHandle* backupHandle = this->m_Data.m_Inputs[slot]; |
| 56 | this->m_Data.m_Inputs[slot] = tensorHandle; |
| 57 | try |
| 58 | { |
| 59 | Reconfigure(); |
| 60 | } |
| 61 | catch(armnn::UnimplementedException& e) |
| 62 | { |
| 63 | // Cannot reconfigure, revert the slot back and throw the exception. |
| 64 | this->m_Data.m_Inputs[slot] = backupHandle; |
| 65 | throw e; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | void NeonFloorFloatWorkload::Reconfigure() |
| 70 | { |
| 71 | throw armnn::UnimplementedException("Reconfigure not implemented for this workload"); |
| 72 | } |
| 73 | |
arovir01 | 9e53a35 | 2018-08-31 15:26:35 +0100 | [diff] [blame] | 74 | } //namespace armnn |
| 75 | |
| 76 | |
| 77 | |