blob: b666e7cc7bea5c118f5b855403abdaddf02c4212 [file] [log] [blame]
Nattapat Chaimanowonga76698c2018-10-11 10:29:15 +01001//
Teresa Charlin588cbdf2022-01-19 15:55:37 +00002// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
Nattapat Chaimanowonga76698c2018-10-11 10:29:15 +01003// SPDX-License-Identifier: MIT
4//
5
6#include "ClReshapeWorkload.hpp"
Aron Virginas-Tarc9cc8042018-11-01 16:15:57 +00007#include <cl/ClTensorHandle.hpp>
Colm Donelan0c479742021-12-10 12:43:54 +00008#include <armnn/backends/TensorHandle.hpp>
Nattapat Chaimanowonga76698c2018-10-11 10:29:15 +01009
10#include "ClWorkloadUtils.hpp"
11
12namespace armnn
13{
14
Kevin Maya023c402019-12-12 17:28:05 +000015arm_compute::Status ClReshapeWorkloadValidate(const TensorInfo& input,
16 const TensorInfo& output)
17{
18 const arm_compute::TensorInfo aclInputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(input);
19 const arm_compute::TensorInfo aclOutputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(output);
20
21 return arm_compute::CLReshapeLayer::validate(&aclInputInfo, &aclOutputInfo);
22}
23
Sadik Armagane9444752020-12-02 11:28:58 +000024ClReshapeWorkload::ClReshapeWorkload(const ReshapeQueueDescriptor& descriptor,
25 const WorkloadInfo& info,
26 const arm_compute::CLCompileContext& clCompileContext)
Teresa Charlin588cbdf2022-01-19 15:55:37 +000027 : ClBaseWorkload<ReshapeQueueDescriptor>(descriptor, info)
Nattapat Chaimanowonga76698c2018-10-11 10:29:15 +010028{
29 m_Data.ValidateInputsOutputs("ClReshapeWorkload", 1, 1);
30
31 arm_compute::ICLTensor& input = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
32 arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
33
Kevin May9f6862d2021-10-22 15:42:28 +010034 {
35 ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "ClReshapeWorkload_configure");
36 m_Layer.configure(clCompileContext, &input, &output);
37 }
Nattapat Chaimanowonga76698c2018-10-11 10:29:15 +010038}
39
40void ClReshapeWorkload::Execute() const
41{
Keith Davisbcd860a2021-08-05 14:20:33 +010042 ARMNN_SCOPED_PROFILING_EVENT_CL_GUID("ClReshapeWorkload_Execute", this->GetGuid());
Aron Virginas-Tara8e06ed2018-10-19 16:46:15 +010043 RunClFunction(m_Layer, CHECK_LOCATION());
Nattapat Chaimanowonga76698c2018-10-11 10:29:15 +010044}
45
46} //namespace armnn