Jan Eilers | f710793 | 2019-11-01 11:09:36 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2019 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "Dequantize.hpp" |
| 7 | |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 8 | #include <armnn/utility/IgnoreUnused.hpp> |
| 9 | |
Jan Eilers | f710793 | 2019-11-01 11:09:36 +0000 | [diff] [blame] | 10 | namespace armnn |
| 11 | { |
| 12 | |
| 13 | void Dequantize(Decoder<float>& inputDecoder, |
| 14 | Encoder<float>& outputEncoder, |
| 15 | const TensorInfo& inputInfo, |
| 16 | const TensorInfo& outputInfo) |
| 17 | { |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 18 | IgnoreUnused(outputInfo); |
Narumol Prangnawarat | ac2770a | 2020-04-01 16:51:23 +0100 | [diff] [blame] | 19 | ARMNN_ASSERT(inputInfo.GetNumElements() == outputInfo.GetNumElements()); |
Jan Eilers | f710793 | 2019-11-01 11:09:36 +0000 | [diff] [blame] | 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 |