blob: b6292833dd4f9145dd11b4a753d9b18898928fc8 [file] [log] [blame]
Aron Virginas-Tar0dd3b432019-09-10 13:55:09 +01001//
2// Copyright © 2019 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#include "NeonRsqrtWorkload.hpp"
7
8#include "NeonWorkloadUtils.hpp"
9
10#include <aclCommon/ArmComputeTensorHandle.hpp>
11#include <aclCommon/ArmComputeTensorUtils.hpp>
12
13#include <boost/cast.hpp>
14
15namespace armnn
16{
17
18arm_compute::Status NeonRsqrtWorkloadValidate(const TensorInfo& input, const TensorInfo& output)
19{
20 const arm_compute::TensorInfo aclInput = armcomputetensorutils::BuildArmComputeTensorInfo(input);
21 const arm_compute::TensorInfo aclOutput = armcomputetensorutils::BuildArmComputeTensorInfo(output);
22
23 return arm_compute::NERsqrtLayer::validate(&aclInput, &aclOutput);
24}
25
26NeonRsqrtWorkload::NeonRsqrtWorkload(const RsqrtQueueDescriptor& descriptor, const WorkloadInfo& info)
27 : BaseWorkload<RsqrtQueueDescriptor>(descriptor, info)
28{
29 m_Data.ValidateInputsOutputs("NeonRsqrtWorkload", 1, 1);
30
31 arm_compute::ITensor& input = boost::polymorphic_downcast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
32 arm_compute::ITensor& output = boost::polymorphic_downcast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
33
34 m_RsqrtLayer.configure(&input, &output);
35}
36
37void NeonRsqrtWorkload::Execute() const
38{
39 ARMNN_SCOPED_PROFILING_EVENT_NEON("NeonRsqrtWorkload_Execute");
40 m_RsqrtLayer.run();
41}
42
43} // namespace armnn