ArmNN
 25.02
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RefQuantizeWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2019-2024 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 
8 #include "RefWorkloadUtils.hpp"
9 
10 #include <armnn/TypesUtils.hpp>
11 
12 
13 namespace armnn
14 {
15 
16 namespace
17 {
18 
19 void QuantizeImpl(Decoder<float>& in, Encoder<float>& out, size_t numValues)
20 {
21  for (unsigned int i = 0; i < numValues; i++)
22  {
23  in[i];
24  out[i];
25  out.Set(in.Get());
26  }
27 }
28 
29 } //namespace
30 
32  : RefBaseWorkload(descriptor, info)
33  , m_NumElements(info.m_InputTensorInfos[0].GetNumElements())
34 {
35 }
36 
38 {
40 }
41 
42 void RefQuantizeWorkload::Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const
43 {
44  ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID("RefQuantizeWorkload_Execute");
45 
46  std::unique_ptr<Decoder<float>> inputDecoder = MakeDecoder<float>(GetTensorInfo(inputs[0]), inputs[0]->Map());
47  std::unique_ptr<Encoder<float>> outputEncoder = MakeEncoder<float>(GetTensorInfo(outputs[0]), outputs[0]->Map());
48 
49  QuantizeImpl(*inputDecoder, *outputEncoder, m_NumElements);
50 }
51 
52 } //namespace armnn
#define ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
QueueDescriptor m_Data
Definition: Workload.hpp:74
RefQuantizeWorkload(const QuantizeQueueDescriptor &descriptor, const WorkloadInfo &info)
void Execute() const override
Copyright (c) 2021 ARM Limited and Contributors.
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
std::vector< ITensorHandle * > m_Inputs
std::vector< ITensorHandle * > m_Outputs
Contains information about TensorInfos of a layer.