aboutsummaryrefslogtreecommitdiff
path: root/src/backends/reference/workloads/Dequantize.cpp
blob: fdc8e30c75f16ed30bd8e2aa73516abf6bd7a76a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//
// Copyright © 2019 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

#include "Dequantize.hpp"

#include <armnn/utility/IgnoreUnused.hpp>

namespace armnn
{

void Dequantize(Decoder<float>& inputDecoder,
                Encoder<float>& outputEncoder,
                const TensorInfo& inputInfo,
                const TensorInfo& outputInfo)
{
    IgnoreUnused(outputInfo);
    ARMNN_ASSERT(inputInfo.GetNumElements() == outputInfo.GetNumElements());
    for (unsigned int i = 0; i < inputInfo.GetNumElements(); i++)
    {
        // inputDecoder.Get() dequantizes the data element from whatever
        // type is given by inputInfo to fp32 (If MakeDecoder supports that dequantization)
        // outputEncoder.Set() transforms the data element to whatever type is
        // given by outputInfo (if MakeEncoder supports that transformation)
        outputEncoder.Set(inputDecoder.Get());
        ++outputEncoder;
        ++inputDecoder;
    }
}

} // armnn namespace