ArmNN
 24.02
NeonPreluWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2019-2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "NeonPreluWorkload.hpp"
7 #include "NeonWorkloadUtils.hpp"
8 
11 
12 #include <arm_compute/runtime/NEON/functions/NEPReluLayer.h>
13 
14 namespace armnn
15 {
16 
18  const TensorInfo& alpha,
19  const TensorInfo& output)
20 {
21  const arm_compute::TensorInfo aclInput = armcomputetensorutils::BuildArmComputeTensorInfo(input);
22  const arm_compute::TensorInfo aclAlpha = armcomputetensorutils::BuildArmComputeTensorInfo(alpha);
23  const arm_compute::TensorInfo aclOutput = armcomputetensorutils::BuildArmComputeTensorInfo(output);
24 
25  return arm_compute::NEPReluLayer::validate(&aclInput,
26  &aclAlpha,
27  &aclOutput);
28 }
29 
31  const WorkloadInfo& info)
33 {
34  m_Data.ValidateInputsOutputs("NeonPreluWorkload", 1, 1);
35 
36  arm_compute::ITensor& input = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
37  arm_compute::ITensor& alpha = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[1])->GetTensor();
38  arm_compute::ITensor& output = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
39 
40  auto layer = std::make_unique<arm_compute::NEPReluLayer>();
41  layer->configure(&input, &alpha, &output);
42 
43  m_PreluLayer.reset(layer.release());
44 }
45 
47 {
48  ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID("NeonPreluWorkload_Execute");
49  m_PreluLayer->run();
50 }
51 
52 } //namespace armnn
armnn::QueueDescriptor::ValidateInputsOutputs
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
Definition: WorkloadData.cpp:446
armnn::TensorInfo
Definition: Tensor.hpp:152
armnn::PreluQueueDescriptor
Definition: WorkloadData.hpp:539
armnn::WorkloadInfo
Contains information about TensorInfos of a layer.
Definition: WorkloadInfo.hpp:16
PolymorphicDowncast.hpp
armnn::NeonPreluWorkloadValidate
arm_compute::Status NeonPreluWorkloadValidate(const TensorInfo &input, const TensorInfo &alpha, const TensorInfo &output)
Definition: NeonPreluWorkload.cpp:17
ArmComputeUtils.hpp
armnn::BoostLogSeverityMapping::info
@ info
armnn::QueueDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkloadData.hpp:27
armnn::Status
Status
Definition: Types.hpp:42
armnn::BaseWorkload< PreluQueueDescriptor >::m_Data
PreluQueueDescriptor m_Data
Definition: Workload.hpp:89
NeonWorkloadUtils.hpp
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
NeonPreluWorkload.hpp
armnn::NeonPreluWorkload::NeonPreluWorkload
NeonPreluWorkload(const PreluQueueDescriptor &descriptor, const WorkloadInfo &info)
Definition: NeonPreluWorkload.cpp:30
armnn::NeonPreluWorkload::Execute
void Execute() const override
Definition: NeonPreluWorkload.cpp:46
ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID
#define ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
Definition: NeonWorkloadUtils.hpp:32
armnn::NeonBaseWorkload
Definition: NeonBaseWorkload.hpp:13
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26