blob: 06074b8bf8ae2432fb12778a7b2a6b921f8bc4b8 [file] [log] [blame]
//
// Copyright © 2017-2023 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "ClFloorFloatWorkload.hpp"
#include <cl/ClTensorHandle.hpp>
#include "ClWorkloadUtils.hpp"
namespace armnn
{
arm_compute::Status ClFloorWorkloadValidate(const TensorInfo& input,
const TensorInfo& output)
{
const arm_compute::TensorInfo aclInput = armcomputetensorutils::BuildArmComputeTensorInfo(input);
const arm_compute::TensorInfo aclOutput = armcomputetensorutils::BuildArmComputeTensorInfo(output);
return arm_compute::CLFloor::validate(&aclInput, &aclOutput);
}
ClFloorFloatWorkload::ClFloorFloatWorkload(const FloorQueueDescriptor& descriptor,
const WorkloadInfo& info,
const arm_compute::CLCompileContext& clCompileContext)
: FloatWorkload<FloorQueueDescriptor>(descriptor, info)
{
m_Data.ValidateInputsOutputs("ClFloorFloatWorkload", 1, 1);
arm_compute::ICLTensor& input = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
{
ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID("ClFloorFloatWorkload_configure");
m_Layer.configure(clCompileContext, &input, &output);
}
}
void ClFloorFloatWorkload::Execute() const
{
ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID("ClFloorFloatWorkload_Execute");
RunClFunction(m_Layer, CHECK_LOCATION());
}
void ClFloorFloatWorkload::ReplaceInputTensorHandle(ITensorHandle* tensorHandle, unsigned int slot)
{
ITensorHandle* backupHandle = this->m_Data.m_Inputs[slot];
this->m_Data.m_Inputs[slot] = tensorHandle;
try
{
Reconfigure();
}
catch(armnn::UnimplementedException& e)
{
// Cannot reconfigure, revert the slot back and throw the exception.
this->m_Data.m_Inputs[slot] = backupHandle;
throw e;
}
}
// Replace output tensor handle with the given TensorHandle
void ClFloorFloatWorkload::ReplaceOutputTensorHandle(ITensorHandle* tensorHandle, unsigned int slot)
{
ITensorHandle* backupHandle = this->m_Data.m_Inputs[slot];
this->m_Data.m_Inputs[slot] = tensorHandle;
try
{
Reconfigure();
}
catch(armnn::UnimplementedException& e)
{
// Cannot reconfigure, revert the slot back and throw the exception.
this->m_Data.m_Inputs[slot] = backupHandle;
throw e;
}
}
void ClFloorFloatWorkload::Reconfigure()
{
throw armnn::UnimplementedException("Reconfigure not implemented for this workload");
}
} //namespace armnn