Nattapat Chaimanowong | cce11fc | 2018-10-12 16:30:56 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "NeonReshapeWorkload.hpp" |
| 7 | |
Matthew Bentham | d80a712 | 2019-01-08 17:52:37 +0000 | [diff] [blame] | 8 | #include "NeonWorkloadUtils.hpp" |
| 9 | |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 10 | #include <armnn/utility/PolymorphicDowncast.hpp> |
Matthew Bentham | d80a712 | 2019-01-08 17:52:37 +0000 | [diff] [blame] | 11 | |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 12 | #include <arm_compute/runtime/NEON/functions/NEReshapeLayer.h> |
Matthew Bentham | d80a712 | 2019-01-08 17:52:37 +0000 | [diff] [blame] | 13 | |
Nattapat Chaimanowong | cce11fc | 2018-10-12 16:30:56 +0100 | [diff] [blame] | 14 | namespace armnn |
| 15 | { |
| 16 | |
Kevin May | a023c40 | 2019-12-12 17:28:05 +0000 | [diff] [blame] | 17 | arm_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 Chaimanowong | cce11fc | 2018-10-12 16:30:56 +0100 | [diff] [blame] | 26 | NeonReshapeWorkload::NeonReshapeWorkload(const ReshapeQueueDescriptor& descriptor, |
| 27 | const WorkloadInfo& info) |
| 28 | : BaseWorkload<ReshapeQueueDescriptor>(descriptor, info) |
| 29 | { |
| 30 | m_Data.ValidateInputsOutputs("NeonReshapeWorkload", 1, 1); |
| 31 | |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 32 | 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 Chaimanowong | cce11fc | 2018-10-12 16:30:56 +0100 | [diff] [blame] | 34 | |
Matthew Bentham | d80a712 | 2019-01-08 17:52:37 +0000 | [diff] [blame] | 35 | auto layer = std::make_unique<arm_compute::NEReshapeLayer>(); |
| 36 | layer->configure(&input, &output); |
| 37 | m_Layer.reset(layer.release()); |
Nattapat Chaimanowong | cce11fc | 2018-10-12 16:30:56 +0100 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | void NeonReshapeWorkload::Execute() const |
| 41 | { |
| 42 | ARMNN_SCOPED_PROFILING_EVENT_NEON("NeonReshapeWorkload_Execute"); |
Matthew Bentham | d80a712 | 2019-01-08 17:52:37 +0000 | [diff] [blame] | 43 | m_Layer->run(); |
Nattapat Chaimanowong | cce11fc | 2018-10-12 16:30:56 +0100 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | } //namespace armnn |