blob: fafc03e69b29a2d4973edf06b8a07243d96ee901 [file] [log] [blame]
Jan Eilersf7107932019-11-01 11:09:36 +00001//
2// Copyright © 2019 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#include "Dequantize.hpp"
7
8namespace armnn
9{
10
11void Dequantize(Decoder<float>& inputDecoder,
12 Encoder<float>& outputEncoder,
13 const TensorInfo& inputInfo,
14 const TensorInfo& outputInfo)
15{
16 BOOST_ASSERT(inputInfo.GetNumElements() == outputInfo.GetNumElements());
17 for (unsigned int i = 0; i < inputInfo.GetNumElements(); i++)
18 {
19 // inputDecoder.Get() dequantizes the data element from whatever
20 // type is given by inputInfo to fp32 (If MakeDecoder supports that dequantization)
21 // outputEncoder.Set() transforms the data element to whatever type is
22 // given by outputInfo (if MakeEncoder supports that transformation)
23 outputEncoder.Set(inputDecoder.Get());
24 ++outputEncoder;
25 ++inputDecoder;
26 }
27}
28
29} // armnn namespace