ArmNN
 21.05
ClActivationWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 
8 #include "ClWorkloadUtils.hpp"
9 
11 #include <cl/ClLayerSupport.hpp>
12 #include <cl/ClTensorHandle.hpp>
14 
15 namespace armnn
16 {
18  const TensorInfo& output,
19  const ActivationDescriptor& descriptor)
20 {
21  const arm_compute::TensorInfo aclInput = armcomputetensorutils::BuildArmComputeTensorInfo(input);
22  const arm_compute::TensorInfo aclOutput = armcomputetensorutils::BuildArmComputeTensorInfo(output);
23 
24  const arm_compute::ActivationLayerInfo activationLayerInfo =
26 
27  return arm_compute::CLActivationLayer::validate(&aclInput,
28  &aclOutput,
29  activationLayerInfo);
30 }
31 
33  const WorkloadInfo& info,
34  const arm_compute::CLCompileContext& clCompileContext)
35  : BaseWorkload<ActivationQueueDescriptor>(descriptor, info)
36 {
37  m_Data.ValidateInputsOutputs("ClActivationWorkload", 1, 1);
38 
39  const arm_compute::ActivationLayerInfo activationLayerInfo =
41 
42  arm_compute::ICLTensor& input = static_cast<ClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
43  arm_compute::ICLTensor& output = static_cast<ClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
44  m_ActivationLayer.configure(clCompileContext, &input, &output, activationLayerInfo);
45 }
46 
48 {
49  ARMNN_SCOPED_PROFILING_EVENT_CL("ClActivationWorkload_Execute");
50  RunClFunction(m_ActivationLayer, CHECK_LOCATION());
51 }
52 
53 } //namespace armnn
#define ARMNN_SCOPED_PROFILING_EVENT_CL(name)
void RunClFunction(arm_compute::IFunction &function, const CheckLocation &location)
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
An ActivationDescriptor for the ActivationLayer.
Definition: Descriptors.hpp:25
#define CHECK_LOCATION()
Definition: Exceptions.hpp:197
ClActivationWorkload(const ActivationQueueDescriptor &descriptor, const WorkloadInfo &info, const arm_compute::CLCompileContext &clCompileContext)
std::vector< ITensorHandle * > m_Outputs
Contains information about inputs and outputs to a layer.
std::vector< ITensorHandle * > m_Inputs
arm_compute::Status ClActivationWorkloadValidate(const TensorInfo &input, const TensorInfo &output, const ActivationDescriptor &descriptor)
arm_compute::ActivationLayerInfo ConvertActivationDescriptorToAclActivationLayerInfo(const ActivationDescriptor &actDesc)