2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // See LICENSE file in the project root for full license information.
6 #include "ClBaseConstantWorkload.hpp"
7 #include "backends/ArmComputeTensorUtils.hpp"
8 #include "backends/ClTensorHandle.hpp"
9 #include "backends/CpuTensorHandle.hpp"
15 template class ClBaseConstantWorkload<DataType::Float16, DataType::Float32>;
16 template class ClBaseConstantWorkload<DataType::QuantisedAsymm8>;
18 template<armnn::DataType... dataTypes>
19 void ClBaseConstantWorkload<dataTypes...>::Execute() const
21 // The intermediate tensor held by the corresponding layer output handler can be initialised with the given data
22 // on the first inference, then reused for subsequent inferences.
23 // The initialisation cannot happen at workload construction time since the ACL kernel for the next layer may not
24 // have been configured at the time.
27 const ConstantQueueDescriptor& data = this->m_Data;
29 BOOST_ASSERT(data.m_LayerOutput != nullptr);
30 arm_compute::CLTensor& output = static_cast<ClTensorHandle*>(data.m_Outputs[0])->GetTensor();
31 arm_compute::DataType computeDataType = static_cast<ClTensorHandle*>(data.m_Outputs[0])->GetDataType();
33 switch (computeDataType)
35 case arm_compute::DataType::F16:
37 CopyArmComputeClTensorData(data.m_LayerOutput->GetConstTensor<Half>(), output);
40 case arm_compute::DataType::F32:
42 CopyArmComputeClTensorData(data.m_LayerOutput->GetConstTensor<float>(), output);
45 case arm_compute::DataType::QASYMM8:
47 CopyArmComputeClTensorData(data.m_LayerOutput->GetConstTensor<uint8_t>(), output);
52 BOOST_ASSERT_MSG(false, "Unknown data type");