blob: 659bb9472363bca4d5755f1a23ef1f1d2c43e4db [file] [log] [blame]
Nattapat Chaimanowongcce11fc2018-10-12 16:30:56 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#include "NeonReshapeWorkload.hpp"
7
Matthew Benthamd80a7122019-01-08 17:52:37 +00008#include "NeonWorkloadUtils.hpp"
9
10#include <arm_compute/runtime/NEON/functions/NEReshapeLayer.h>
11
12#include <boost/polymorphic_cast.hpp>
13
Nattapat Chaimanowongcce11fc2018-10-12 16:30:56 +010014namespace armnn
15{
16
Kevin May8ac5fc32019-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)
28 : BaseWorkload<ReshapeQueueDescriptor>(descriptor, info)
29{
30 m_Data.ValidateInputsOutputs("NeonReshapeWorkload", 1, 1);
31
Derek Lambertic81855f2019-06-13 17:34:19 +010032 arm_compute::ITensor& input = boost::polymorphic_downcast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
33 arm_compute::ITensor& output = boost::polymorphic_downcast<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{
42 ARMNN_SCOPED_PROFILING_EVENT_NEON("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