aboutsummaryrefslogtreecommitdiff
path: root/src/backends/reference/workloads/Dequantize.cpp
diff options
context:
space:
mode:
authorJan Eilers <jan.eilers@arm.com>2019-11-01 11:09:36 +0000
committerJan Eilers <jan.eilers@arm.com>2019-11-04 12:09:08 +0000
commitf71079328ae72a65c91e410b2bd35eabb67cb6d1 (patch)
treee5460c94ea84f0ffb6ec09df820912cd9bd750ec /src/backends/reference/workloads/Dequantize.cpp
parent7ff9a6096e3c1facbd6786993a6437b9f72069d2 (diff)
downloadarmnn-f71079328ae72a65c91e410b2bd35eabb67cb6d1.tar.gz
Add fp16 support for dequantize
* Changed RefDequantizeWorkload to use Encoder/Decoder * Added related unit tests for Cl, Neon and Ref Signed-off-by: Jan Eilers <jan.eilers@arm.com> Change-Id: Ic2fd4103090dd2127c6859b49305736f7b2dfb05
Diffstat (limited to 'src/backends/reference/workloads/Dequantize.cpp')
-rw-r--r--src/backends/reference/workloads/Dequantize.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/backends/reference/workloads/Dequantize.cpp b/src/backends/reference/workloads/Dequantize.cpp
new file mode 100644
index 0000000000..fafc03e69b
--- /dev/null
+++ b/src/backends/reference/workloads/Dequantize.cpp
@@ -0,0 +1,29 @@
+//
+// Copyright © 2019 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include "Dequantize.hpp"
+
+namespace armnn
+{
+
+void Dequantize(Decoder<float>& inputDecoder,
+ Encoder<float>& outputEncoder,
+ const TensorInfo& inputInfo,
+ const TensorInfo& outputInfo)
+{
+ BOOST_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 \ No newline at end of file