24.02
Dequantize.cpp
Go to the documentation of this file.
1
//
2
// Copyright © 2019 Arm Ltd. All rights reserved.
3
// SPDX-License-Identifier: MIT
4
//
5
6
#include "
Dequantize.hpp
"
7
8
#include <
armnn/utility/IgnoreUnused.hpp
>
9
10
namespace
armnn
11
{
12
13
void
Dequantize
(
Decoder<float>
& inputDecoder,
14
Encoder<float>
& outputEncoder,
15
const
TensorInfo
& inputInfo,
16
const
TensorInfo
& outputInfo)
17
{
18
IgnoreUnused
(outputInfo);
19
ARMNN_ASSERT
(inputInfo.
GetNumElements
() == outputInfo.
GetNumElements
());
20
for
(
unsigned
int
i = 0; i < inputInfo.
GetNumElements
(); i++)
21
{
22
// inputDecoder.Get() dequantizes the data element from whatever
23
// type is given by inputInfo to fp32 (If MakeDecoder supports that dequantization)
24
// outputEncoder.Set() transforms the data element to whatever type is
25
// given by outputInfo (if MakeEncoder supports that transformation)
26
outputEncoder.
Set
(inputDecoder.
Get
());
27
++outputEncoder;
28
++inputDecoder;
29
}
30
}
31
32
}
// armnn namespace
ARMNN_ASSERT
#define ARMNN_ASSERT(COND)
Definition:
Assert.hpp:14
armnn::Decoder< float >
armnn::TensorInfo::GetNumElements
unsigned int GetNumElements() const
Definition:
Tensor.hpp:198
armnn::Encoder::Set
virtual void Set(IType right)=0
armnn::TensorInfo
Definition:
Tensor.hpp:152
IgnoreUnused.hpp
armnn::Encoder< float >
armnn::Dequantize
float Dequantize(QuantizedType value, float scale, int32_t offset)
Dequantize an 8-bit data type into a floating point data type.
Definition:
TypesUtils.cpp:52
armnn::Decoder::Get
virtual IType Get() const =0
Dequantize.hpp
armnn::IgnoreUnused
void IgnoreUnused(Ts &&...)
Definition:
IgnoreUnused.hpp:14
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition:
01_00_quick_start.dox:6
src
backends
reference
workloads
Dequantize.cpp
Generated on Wed Feb 14 2024 16:36:17 for Arm NN by
1.8.17