aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2017-09-20 18:36:03 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commitbb3be3989b59de054e2a5d82492290ee6be928b0 (patch)
tree14122c85feb09942a3087c70a2cff14137e7d0fd /tests
parent159b6da5b7c155cf17c227d3a2372f9d2cc46dff (diff)
downloadComputeLibrary-bb3be3989b59de054e2a5d82492290ee6be928b0.tar.gz
COMPMID-417: Fix initial min/max value in CPPQuantizationLayer
The first element of the first batch was wrongly used as an initial value for min/max of all the batches. Changes initial min/max values so that the first element of the corresponding batch to be used. Change-Id: Icaada0098616e111f5b66f47033fb61cf47a7a39 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/88481 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Moritz Pflanzer <moritz.pflanzer@arm.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/validation/CPP/QuantizationLayer.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/tests/validation/CPP/QuantizationLayer.cpp b/tests/validation/CPP/QuantizationLayer.cpp
index 6909da927e..d7ce490209 100644
--- a/tests/validation/CPP/QuantizationLayer.cpp
+++ b/tests/validation/CPP/QuantizationLayer.cpp
@@ -23,6 +23,8 @@
*/
#include "QuantizationLayer.h"
+#include <cmath>
+
namespace arm_compute
{
namespace test
@@ -46,21 +48,15 @@ SimpleTensor<uint8_t> quantization_layer(const SimpleTensor<T> &src)
for(int k = 0; k < num_batches; ++k)
{
// Compute min and max of the 3D tensor
- float min = src[0];
- float max = src[0];
+ float min = src[k * stride_w];
+ float max = src[k * stride_w];
// Look for min and max values
for(int i = 1; i < stride_w; ++i)
{
float val = src[i + k * stride_w];
- if(val < min)
- {
- min = val;
- }
- if(val > max)
- {
- max = val;
- }
+ min = std::min(min, val);
+ max = std::max(max, val);
}
// Saturate the result in case min = max