blob: fdbd9afbed919ee53bb2dc14aacb7716baab9b31 [file] [log] [blame]
arovir019e53a352018-08-31 15:26:35 +01001//
Mike Kelly7cbe7812023-07-25 17:37:33 +01002// Copyright © 2017-2023 Arm Ltd and Contributors. All rights reserved.
David Beckecb56cd2018-09-05 12:52:57 +01003// SPDX-License-Identifier: MIT
arovir019e53a352018-08-31 15:26:35 +01004//
5
6#include "NeonFloorFloatWorkload.hpp"
7
Matthew Benthamd80a7122019-01-08 17:52:37 +00008#include "NeonWorkloadUtils.hpp"
9
Jan Eilersbb446e52020-04-02 13:56:54 +010010#include <armnn/utility/PolymorphicDowncast.hpp>
Matthew Benthamd80a7122019-01-08 17:52:37 +000011
Jan Eilersbb446e52020-04-02 13:56:54 +010012#include <arm_compute/runtime/NEON/functions/NEFloor.h>
Matthew Benthamd80a7122019-01-08 17:52:37 +000013
arovir019e53a352018-08-31 15:26:35 +010014namespace armnn
15{
16NeonFloorFloatWorkload::NeonFloorFloatWorkload(const FloorQueueDescriptor& descriptor,
17 const WorkloadInfo& info)
18 : FloatWorkload<FloorQueueDescriptor>(descriptor, info)
19{
20 m_Data.ValidateInputsOutputs("NeonFloorFloatWorkload", 1, 1);
21
Jan Eilersbb446e52020-04-02 13:56:54 +010022 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();
arovir019e53a352018-08-31 15:26:35 +010024
Matthew Benthamd80a7122019-01-08 17:52:37 +000025 auto layer = std::make_unique<arm_compute::NEFloor>();
26 layer->configure(&input, &output);
27 m_Layer.reset(layer.release());
arovir019e53a352018-08-31 15:26:35 +010028}
29
30void NeonFloorFloatWorkload::Execute() const
31{
Mike Kelly7cbe7812023-07-25 17:37:33 +010032 ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID("NeonFloorFloatWorkload_Execute");
Matthew Benthamd80a7122019-01-08 17:52:37 +000033 m_Layer->run();
arovir019e53a352018-08-31 15:26:35 +010034}
David Monahanec819992022-02-10 14:47:13 +000035
36void 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
53void 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
69void NeonFloorFloatWorkload::Reconfigure()
70{
71 throw armnn::UnimplementedException("Reconfigure not implemented for this workload");
72}
73
arovir019e53a352018-08-31 15:26:35 +010074} //namespace armnn
75
76
77