ArmNN
 25.11
Loading...
Searching...
No Matches
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
9
10#include <armnn/TypesUtils.hpp>
11
12
13namespace armnn
14{
15
16namespace
17{
18
19void 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{
39 Execute(m_Data.m_Inputs, m_Data.m_Outputs);
40}
41
42void 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.
RefBaseWorkload(const QuantizeQueueDescriptor &descriptor, const WorkloadInfo &info)
RefQuantizeWorkload(const QuantizeQueueDescriptor &descriptor, const WorkloadInfo &info)
Copyright (c) 2021 ARM Limited and Contributors.
std::unique_ptr< Decoder< T > > MakeDecoder(const TensorInfo &info, const void *data=nullptr)
std::unique_ptr< Encoder< T > > MakeEncoder(const TensorInfo &info, void *data=nullptr)
armnn::TensorInfo GetTensorInfo(unsigned int numberOfBatches, unsigned int numberOfChannels, unsigned int height, unsigned int width, const armnn::DataLayout dataLayout, const armnn::DataType dataType)
Contains information about TensorInfos of a layer.