ArmNN
 21.05
ClPreluWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "ClPreluWorkload.hpp"
7 #include "ClWorkloadUtils.hpp"
10 #include <cl/ClLayerSupport.hpp>
11 #include <cl/ClTensorHandle.hpp>
12 
13 namespace armnn
14 {
15 
17  const TensorInfo& alpha,
18  const TensorInfo& output)
19 {
20  const arm_compute::TensorInfo aclInput = armcomputetensorutils::BuildArmComputeTensorInfo(input);
21  const arm_compute::TensorInfo aclAlpha = armcomputetensorutils::BuildArmComputeTensorInfo(alpha);
22  const arm_compute::TensorInfo aclOutput = armcomputetensorutils::BuildArmComputeTensorInfo(output);
23 
24  return arm_compute::CLPReluLayer::validate(&aclInput,
25  &aclAlpha,
26  &aclOutput);
27 }
28 
30  const WorkloadInfo& info,
31  const arm_compute::CLCompileContext& clCompileContext)
32  : BaseWorkload<PreluQueueDescriptor>(descriptor, info)
33 {
34  m_Data.ValidateInputsOutputs("ClPreluWorkload", 1, 1);
35 
36  arm_compute::ICLTensor& input = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
37  arm_compute::ICLTensor& alpha = static_cast<IClTensorHandle*>(m_Data.m_Inputs[1])->GetTensor();
38  arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
39 
40  m_PreluLayer.configure(clCompileContext, &input, &alpha, &output);
41 }
42 
44 {
45  ARMNN_SCOPED_PROFILING_EVENT_CL("ClPreluWorkload_Execute");
46  RunClFunction(m_PreluLayer, CHECK_LOCATION());
47 }
48 
49 } //namespace armnn
void Execute() const override
#define ARMNN_SCOPED_PROFILING_EVENT_CL(name)
void RunClFunction(arm_compute::IFunction &function, const CheckLocation &location)
ClPreluWorkload(const PreluQueueDescriptor &descriptor, const WorkloadInfo &info, const arm_compute::CLCompileContext &clCompileContext)
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
Copyright (c) 2021 ARM Limited and Contributors.
Status
enumeration
Definition: Types.hpp:30
#define CHECK_LOCATION()
Definition: Exceptions.hpp:197
arm_compute::Status ClPreluWorkloadValidate(const TensorInfo &input, const TensorInfo &alpha, const TensorInfo &output)
std::vector< ITensorHandle * > m_Outputs
Contains information about inputs and outputs to a layer.
std::vector< ITensorHandle * > m_Inputs