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 | |
| 8 | namespace armnn |
| 9 | { |
| 10 | |
| 11 | void 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 |