blob: 9da6f19e2bc9ac793dc4592896a32611a6c87932 [file] [log] [blame]
Nattapat Chaimanowongcce11fc2018-10-12 16:30:56 +01001//
Mike Kelly7cbe7812023-07-25 17:37:33 +01002// Copyright © 2017-2023 Arm Ltd and Contributors. All rights reserved.
Nattapat Chaimanowongcce11fc2018-10-12 16:30:56 +01003// SPDX-License-Identifier: MIT
4//
5
6#include "NeonReshapeWorkload.hpp"
7
Matthew Benthamd80a7122019-01-08 17:52:37 +00008#include "NeonWorkloadUtils.hpp"
9
Jan Eilersbb446e52020-04-02 13:56:54 +010010#include <armnn/utility/PolymorphicDowncast.hpp>
Matthew Benthamd80a7122019-01-08 17:52:37 +000011
Jan Eilersbb446e52020-04-02 13:56:54 +010012#include <arm_compute/runtime/NEON/functions/NEReshapeLayer.h>
Matthew Benthamd80a7122019-01-08 17:52:37 +000013
Nattapat Chaimanowongcce11fc2018-10-12 16:30:56 +010014namespace armnn
15{
16
Kevin Maya023c402019-12-12 17:28:05 +000017arm_compute::Status NeonReshapeWorkloadValidate(const TensorInfo& input,
18 const TensorInfo& output)
19{
20 const arm_compute::TensorInfo aclInputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(input);
21 const arm_compute::TensorInfo aclOutputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(output);
22
23 return arm_compute::NEReshapeLayer::validate(&aclInputInfo, &aclOutputInfo);
24}
25
Nattapat Chaimanowongcce11fc2018-10-12 16:30:56 +010026NeonReshapeWorkload::NeonReshapeWorkload(const ReshapeQueueDescriptor& descriptor,
27 const WorkloadInfo& info)
Teresa Charlin588cbdf2022-01-19 15:55:37 +000028 : NeonBaseWorkload<ReshapeQueueDescriptor>(descriptor, info)
Nattapat Chaimanowongcce11fc2018-10-12 16:30:56 +010029{
30 m_Data.ValidateInputsOutputs("NeonReshapeWorkload", 1, 1);
31
Jan Eilersbb446e52020-04-02 13:56:54 +010032 arm_compute::ITensor& input = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
33 arm_compute::ITensor& output = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
Nattapat Chaimanowongcce11fc2018-10-12 16:30:56 +010034
Matthew Benthamd80a7122019-01-08 17:52:37 +000035 auto layer = std::make_unique<arm_compute::NEReshapeLayer>();
36 layer->configure(&input, &output);
37 m_Layer.reset(layer.release());
Nattapat Chaimanowongcce11fc2018-10-12 16:30:56 +010038}
39
40void NeonReshapeWorkload::Execute() const
41{
Mike Kelly7cbe7812023-07-25 17:37:33 +010042 ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID("NeonReshapeWorkload_Execute");
Matthew Benthamd80a7122019-01-08 17:52:37 +000043 m_Layer->run();
Nattapat Chaimanowongcce11fc2018-10-12 16:30:56 +010044}
45
46} //namespace armnn