ArmNN
 24.08
ClBatchNormalizationFloatWorkload.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include "ClBaseWorkload.hpp"
9 
10 #include <arm_compute/runtime/CL/CLTensor.h>
11 #include <arm_compute/runtime/CL/functions/CLBatchNormalizationLayer.h>
12 
13 namespace armnn
14 {
15 
17  const TensorInfo& output,
18  const TensorInfo& mean,
19  const TensorInfo& var,
20  const TensorInfo& beta,
21  const TensorInfo& gamma,
22  const BatchNormalizationDescriptor& descriptor,
23  const ActivationDescriptor* activationDescriptor = nullptr);
24 
25 class ClBatchNormalizationFloatWorkload : public FloatWorkload<BatchNormalizationQueueDescriptor>
26 {
27 public:
29  const WorkloadInfo& info,
30  const arm_compute::CLCompileContext& clCompileContext);
31 
33  void Execute() const override;
34 
35  // Replace input tensor handle with the given TensorHandle
36  void ReplaceInputTensorHandle(ITensorHandle* tensorHandle, unsigned int slot) override;
37 
38  // Replace output tensor handle with the given TensorHandle
39  void ReplaceOutputTensorHandle(ITensorHandle* tensorHandle, unsigned int slot) override;
40 
41 private:
42  mutable arm_compute::CLBatchNormalizationLayer m_Layer;
43 
44  std::unique_ptr<arm_compute::CLTensor> m_Mean;
45  std::unique_ptr<arm_compute::CLTensor> m_Variance;
46  std::unique_ptr<arm_compute::CLTensor> m_Gamma;
47  std::unique_ptr<arm_compute::CLTensor> m_Beta;
48 
49  void FreeUnusedTensors();
50  virtual void Reconfigure();
51 };
52 
53 } //namespace armnn
54 
55 
56 
57 
armnn::BatchNormalizationQueueDescriptor
Definition: WorkloadData.hpp:311
armnn::ITensorHandle
Definition: ITensorHandle.hpp:16
armnn::ClBatchNormalizationFloatWorkload
Definition: ClBatchNormalizationFloatWorkload.hpp:25
armnn::TypedWorkload
Definition: Workload.hpp:101
armnn::WorkloadInfo
Contains information about TensorInfos of a layer.
Definition: WorkloadInfo.hpp:16
armnn::ClBatchNormalizationFloatWorkload::ReplaceInputTensorHandle
void ReplaceInputTensorHandle(ITensorHandle *tensorHandle, unsigned int slot) override
Definition: ClBatchNormalizationFloatWorkload.cpp:127
armnn::ClBatchNormalizationFloatWorkload::ReplaceOutputTensorHandle
void ReplaceOutputTensorHandle(ITensorHandle *tensorHandle, unsigned int slot) override
Definition: ClBatchNormalizationFloatWorkload.cpp:144
armnn::BoostLogSeverityMapping::info
@ info
armnn::Status
Status
Definition: Types.hpp:42
armnn::ClBatchNormalizationValidate
arm_compute::Status ClBatchNormalizationValidate(const TensorInfo &input, const TensorInfo &output, const TensorInfo &mean, const TensorInfo &var, const TensorInfo &beta, const TensorInfo &gamma, const BatchNormalizationDescriptor &descriptor, const ActivationDescriptor *activationDescriptor)
Definition: ClBatchNormalizationFloatWorkload.cpp:19
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
ClBaseWorkload.hpp
armnn::ClBatchNormalizationFloatWorkload::Execute
void Execute() const override
Definition: ClBatchNormalizationFloatWorkload.cpp:113
armnn::ClBatchNormalizationFloatWorkload::ClBatchNormalizationFloatWorkload
ClBatchNormalizationFloatWorkload(const BatchNormalizationQueueDescriptor &descriptor, const WorkloadInfo &info, const arm_compute::CLCompileContext &clCompileContext)
Definition: ClBatchNormalizationFloatWorkload.cpp:54