ArmNN
 24.02
NeonFloorFloatWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017-2023 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)
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_NAME_GUID("NeonFloorFloatWorkload_Execute");
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 
armnn::QueueDescriptor::ValidateInputsOutputs
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
Definition: WorkloadData.cpp:446
armnn::FloorQueueDescriptor
Definition: WorkloadData.hpp:395
armnn::ITensorHandle
Definition: ITensorHandle.hpp:16
NeonFloorFloatWorkload.hpp
armnn::TypedWorkload
Definition: Workload.hpp:101
armnn::NeonFloorFloatWorkload::ReplaceOutputTensorHandle
void ReplaceOutputTensorHandle(ITensorHandle *tensorHandle, unsigned int slot) override
Definition: NeonFloorFloatWorkload.cpp:53
armnn::NeonFloorFloatWorkload::Execute
virtual void Execute() const override
Definition: NeonFloorFloatWorkload.cpp:30
armnn::WorkloadInfo
Contains information about TensorInfos of a layer.
Definition: WorkloadInfo.hpp:16
PolymorphicDowncast.hpp
armnn::BoostLogSeverityMapping::info
@ info
armnn::NeonFloorFloatWorkload::NeonFloorFloatWorkload
NeonFloorFloatWorkload(const FloorQueueDescriptor &descriptor, const WorkloadInfo &info)
Definition: NeonFloorFloatWorkload.cpp:16
armnn::QueueDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkloadData.hpp:27
armnn::BaseWorkload::m_Data
QueueDescriptor m_Data
Definition: Workload.hpp:89
NeonWorkloadUtils.hpp
armnn::NeonFloorFloatWorkload::ReplaceInputTensorHandle
void ReplaceInputTensorHandle(ITensorHandle *tensorHandle, unsigned int slot) override
Definition: NeonFloorFloatWorkload.cpp:36
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::UnimplementedException
Definition: Exceptions.hpp:98
ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID
#define ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
Definition: NeonWorkloadUtils.hpp:32
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26