aboutsummaryrefslogtreecommitdiff
path: root/src/backends/reference/workloads/Dequantize.cpp
diff options
context:
space:
mode:
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