ArmNN
 25.11
Loading...
Searching...
No Matches
Dequantize.cpp
Go to the documentation of this file.
1//
2// Copyright © 2019, 2024 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{
17 inputInfo.GetNumElements() == outputInfo.GetNumElements(),
18 "Dequantize: The number of elements in the input and output tensors must be the same.");
19 for (unsigned int i = 0; i < inputInfo.GetNumElements(); i++)
20 {
21 // inputDecoder.Get() dequantizes the data element from whatever
22 // type is given by inputInfo to fp32 (If MakeDecoder supports that dequantization)
23 // outputEncoder.Set() transforms the data element to whatever type is
24 // given by outputInfo (if MakeEncoder supports that transformation)
25 outputEncoder.Set(inputDecoder.Get());
26 ++outputEncoder;
27 ++inputDecoder;
28 }
29}
30
31} // armnn namespace
#define ARMNN_THROW_INVALIDARG_MSG_IF_FALSE(_cond, _str)
virtual IType Get() const =0
virtual void Set(IType right)=0
unsigned int GetNumElements() const
Definition Tensor.hpp:198
Copyright (c) 2021 ARM Limited and Contributors.