ArmNN
 22.11
NeonFloorFloatWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 
8 #include "NeonWorkloadUtils.hpp"
9 
11 
12 #include <arm_compute/runtime/NEON/functions/NEFloor.h>
13 
14 namespace armnn
15 {
17  const WorkloadInfo& info)
18  : FloatWorkload<FloorQueueDescriptor>(descriptor, info)
19 {
20  m_Data.ValidateInputsOutputs("NeonFloorFloatWorkload", 1, 1);
21 
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();
24 
25  auto layer = std::make_unique<arm_compute::NEFloor>();
26  layer->configure(&input, &output);
27  m_Layer.reset(layer.release());
28 }
29 
31 {
32  ARMNN_SCOPED_PROFILING_EVENT_NEON_GUID("NeonFloorFloatWorkload_Execute", this->GetGuid());
33  m_Layer->run();
34 }
35 
37 {
38  ITensorHandle* backupHandle = this->m_Data.m_Inputs[slot];
39  this->m_Data.m_Inputs[slot] = tensorHandle;
40  try
41  {
42  Reconfigure();
43  }
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
54 {
55  ITensorHandle* backupHandle = this->m_Data.m_Inputs[slot];
56  this->m_Data.m_Inputs[slot] = tensorHandle;
57  try
58  {
59  Reconfigure();
60  }
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 
74 } //namespace armnn
75 
76 
77 
arm::pipe::ProfilingGuid GetGuid() const final
Definition: Workload.hpp:61
void ReplaceOutputTensorHandle(ITensorHandle *tensorHandle, unsigned int slot) override
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
Copyright (c) 2021 ARM Limited and Contributors.
QueueDescriptor m_Data
Definition: Workload.hpp:83
NeonFloorFloatWorkload(const FloorQueueDescriptor &descriptor, const WorkloadInfo &info)
void ReplaceInputTensorHandle(ITensorHandle *tensorHandle, unsigned int slot) override
std::vector< ITensorHandle * > m_Outputs
Contains information about TensorInfos of a layer.
std::vector< ITensorHandle * > m_Inputs
#define ARMNN_SCOPED_PROFILING_EVENT_NEON_GUID(name, guid)
virtual void Execute() const override