ArmNN
 24.02
ClFloorFloatWorkload.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 #include <cl/ClTensorHandle.hpp>
8 
9 #include "ClWorkloadUtils.hpp"
10 
11 namespace armnn
12 {
13 
15  const TensorInfo& output)
16 {
17  const arm_compute::TensorInfo aclInput = armcomputetensorutils::BuildArmComputeTensorInfo(input);
18  const arm_compute::TensorInfo aclOutput = armcomputetensorutils::BuildArmComputeTensorInfo(output);
19 
20  return arm_compute::CLFloor::validate(&aclInput, &aclOutput);
21 }
22 
24  const WorkloadInfo& info,
25  const arm_compute::CLCompileContext& clCompileContext)
27 {
28  m_Data.ValidateInputsOutputs("ClFloorFloatWorkload", 1, 1);
29 
30  arm_compute::ICLTensor& input = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
31  arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
32  {
33  ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID("ClFloorFloatWorkload_configure");
34  m_Layer.configure(clCompileContext, &input, &output);
35  }
36 }
37 
39 {
40  ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID("ClFloorFloatWorkload_Execute");
41  RunClFunction(m_Layer, CHECK_LOCATION());
42 }
43 
44 void ClFloorFloatWorkload::ReplaceInputTensorHandle(ITensorHandle* tensorHandle, unsigned int slot)
45 {
46  ITensorHandle* backupHandle = this->m_Data.m_Inputs[slot];
47  this->m_Data.m_Inputs[slot] = tensorHandle;
48  try
49  {
50  Reconfigure();
51  }
53  {
54  // Cannot reconfigure, revert the slot back and throw the exception.
55  this->m_Data.m_Inputs[slot] = backupHandle;
56  throw e;
57  }
58 }
59 
60 // Replace output tensor handle with the given TensorHandle
61 void ClFloorFloatWorkload::ReplaceOutputTensorHandle(ITensorHandle* tensorHandle, unsigned int slot)
62 {
63  ITensorHandle* backupHandle = this->m_Data.m_Inputs[slot];
64  this->m_Data.m_Inputs[slot] = tensorHandle;
65  try
66  {
67  Reconfigure();
68  }
70  {
71  // Cannot reconfigure, revert the slot back and throw the exception.
72  this->m_Data.m_Inputs[slot] = backupHandle;
73  throw e;
74  }
75 }
76 
77 void ClFloorFloatWorkload::Reconfigure()
78 {
79  throw armnn::UnimplementedException("Reconfigure not implemented for this workload");
80 }
81 
82 } //namespace armnn
armnn::ClFloorWorkloadValidate
arm_compute::Status ClFloorWorkloadValidate(const TensorInfo &input, const TensorInfo &output)
Definition: ClFloorFloatWorkload.cpp:14
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::TensorInfo
Definition: Tensor.hpp:152
CHECK_LOCATION
#define CHECK_LOCATION()
Definition: Exceptions.hpp:203
armnn::ITensorHandle
Definition: ITensorHandle.hpp:16
armnn::TypedWorkload
Definition: Workload.hpp:101
ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID
#define ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
Definition: ClWorkloadUtils.hpp:36
armnn::WorkloadInfo
Contains information about TensorInfos of a layer.
Definition: WorkloadInfo.hpp:16
ClWorkloadUtils.hpp
armnn::ClFloorFloatWorkload::ClFloorFloatWorkload
ClFloorFloatWorkload(const FloorQueueDescriptor &descriptor, const WorkloadInfo &info, const arm_compute::CLCompileContext &clCompileContext)
Definition: ClFloorFloatWorkload.cpp:23
armnn::BoostLogSeverityMapping::info
@ info
armnn::QueueDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkloadData.hpp:27
armnn::IClTensorHandle
Definition: IClTensorHandle.hpp:13
armnn::Status
Status
Definition: Types.hpp:42
ClTensorHandle.hpp
armnn::BaseWorkload::m_Data
QueueDescriptor m_Data
Definition: Workload.hpp:89
armnn::RunClFunction
void RunClFunction(arm_compute::IFunction &function, const CheckLocation &location)
Definition: ClWorkloadUtils.hpp:168
armnn::ClFloorFloatWorkload::Execute
void Execute() const override
Definition: ClFloorFloatWorkload.cpp:38
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
ClFloorFloatWorkload.hpp
armnn::ClFloorFloatWorkload::ReplaceOutputTensorHandle
void ReplaceOutputTensorHandle(ITensorHandle *tensorHandle, unsigned int slot) override
Definition: ClFloorFloatWorkload.cpp:61
armnn::UnimplementedException
Definition: Exceptions.hpp:98
armnn::ClFloorFloatWorkload::ReplaceInputTensorHandle
void ReplaceInputTensorHandle(ITensorHandle *tensorHandle, unsigned int slot) override
Definition: ClFloorFloatWorkload.cpp:44
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26