Sadik Armagan | c625f00 | 2018-12-17 11:32:16 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "NeonResizeBilinearWorkload.hpp" |
| 7 | |
| 8 | #include <aclCommon/ArmComputeUtils.hpp> |
| 9 | #include <aclCommon/ArmComputeTensorUtils.hpp> |
| 10 | #include <backendsCommon/CpuTensorHandle.hpp> |
| 11 | #include <neon/NeonTensorHandle.hpp> |
| 12 | #include <neon/NeonLayerSupport.hpp> |
| 13 | |
| 14 | using namespace armnn::armcomputetensorutils; |
| 15 | |
| 16 | namespace armnn |
| 17 | { |
| 18 | |
| 19 | arm_compute::Status NeonResizeBilinearWorkloadValidate(const TensorInfo& input, const TensorInfo& output) |
| 20 | { |
| 21 | const arm_compute::TensorInfo aclInputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(input); |
| 22 | const arm_compute::TensorInfo aclOutputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(output); |
| 23 | |
| 24 | return arm_compute::NEScale::validate(&aclInputInfo, |
| 25 | &aclOutputInfo, |
| 26 | arm_compute::InterpolationPolicy::BILINEAR, |
| 27 | arm_compute::BorderMode::REPLICATE, |
| 28 | arm_compute::PixelValue(0.f), |
| 29 | arm_compute::SamplingPolicy::TOP_LEFT); |
| 30 | } |
| 31 | |
| 32 | NeonResizeBilinearWorkload::NeonResizeBilinearWorkload(const ResizeBilinearQueueDescriptor& descriptor, |
| 33 | const WorkloadInfo& info) |
| 34 | : BaseWorkload<ResizeBilinearQueueDescriptor>(descriptor, info) |
| 35 | { |
| 36 | m_Data.ValidateInputsOutputs("NeonResizeBilinearWorkload", 1, 1); |
| 37 | |
Derek Lamberti | c81855f | 2019-06-13 17:34:19 +0100 | [diff] [blame] | 38 | arm_compute::ITensor& input = boost::polymorphic_downcast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 39 | arm_compute::ITensor& output = boost::polymorphic_downcast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
Sadik Armagan | c625f00 | 2018-12-17 11:32:16 +0000 | [diff] [blame] | 40 | |
| 41 | arm_compute::DataLayout aclDataLayout = ConvertDataLayout(m_Data.m_Parameters.m_DataLayout); |
| 42 | input.info()->set_data_layout(aclDataLayout); |
| 43 | output.info()->set_data_layout(aclDataLayout); |
| 44 | |
| 45 | m_ResizeBilinearLayer.configure(&input, |
| 46 | &output, |
| 47 | arm_compute::InterpolationPolicy::BILINEAR, |
| 48 | arm_compute::BorderMode::REPLICATE, |
| 49 | arm_compute::PixelValue(0.f), |
| 50 | arm_compute::SamplingPolicy::TOP_LEFT); |
| 51 | }; |
| 52 | |
| 53 | void NeonResizeBilinearWorkload::Execute() const |
| 54 | { |
| 55 | ARMNN_SCOPED_PROFILING_EVENT_NEON("NeonResizeBilinearWorkload_Execute"); |
| 56 | m_ResizeBilinearLayer.run(); |
| 57 | } |
| 58 | |
| 59 | } //namespace armnn |