ArmNN
 25.11
Loading...
Searching...
No Matches
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
8
9#include "ClWorkloadUtils.hpp"
10
11namespace armnn
12{
13
14arm_compute::Status ClFloorWorkloadValidate(const TensorInfo& input,
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
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
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
77void ClFloorFloatWorkload::Reconfigure()
78{
79 throw armnn::UnimplementedException("Reconfigure not implemented for this workload");
80}
81
82} //namespace armnn
#define ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
#define CHECK_LOCATION()
QueueDescriptor m_Data
Definition Workload.hpp:74
ClFloorFloatWorkload(const FloorQueueDescriptor &descriptor, const WorkloadInfo &info, const arm_compute::CLCompileContext &clCompileContext)
void ReplaceInputTensorHandle(ITensorHandle *tensorHandle, unsigned int slot) override
void ReplaceOutputTensorHandle(ITensorHandle *tensorHandle, unsigned int slot) override
virtual arm_compute::ICLTensor & GetTensor()=0
Copyright (c) 2021 ARM Limited and Contributors.
void RunClFunction(arm_compute::IFunction &function, const CheckLocation &location)
arm_compute::Status ClFloorWorkloadValidate(const TensorInfo &input, const TensorInfo &output)
TypedWorkload< QueueDescriptor, armnn::DataType::Float16, armnn::DataType::Float32 > FloatWorkload
Definition Workload.hpp:195
Contains information about TensorInfos of a layer.