aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/reference/SpaceToBatch.cpp
diff options
context:
space:
mode:
authorMichele Di Giorgio <michele.digiorgio@arm.com>2019-08-08 11:59:14 +0100
committerMichele Di Giorgio <michele.digiorgio@arm.com>2019-08-09 14:00:21 +0000
commit93c70b8d7c69ddcee58162c2618aa0e898b4bd1e (patch)
tree45912a9305600b37568fd9b1e5232666ab5448fe /tests/validation/reference/SpaceToBatch.cpp
parent172035864c8eb73fc46aeec1075423526a768e83 (diff)
downloadComputeLibrary-93c70b8d7c69ddcee58162c2618aa0e898b4bd1e.tar.gz
COMPMID-2547: CLSpaceToBatchLayer causes NN Test Failures on QUANT8_ASYMM Data Type
Change-Id: I47c9d057e50fa624f9b9e3fd79724e4fa7d0fd82 Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com> Reviewed-on: https://review.mlplatform.org/c/1713 Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/validation/reference/SpaceToBatch.cpp')
-rw-r--r--tests/validation/reference/SpaceToBatch.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/validation/reference/SpaceToBatch.cpp b/tests/validation/reference/SpaceToBatch.cpp
index c635d4abfd..8c25bb7d91 100644
--- a/tests/validation/reference/SpaceToBatch.cpp
+++ b/tests/validation/reference/SpaceToBatch.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -37,7 +37,7 @@ namespace reference
template <typename T>
SimpleTensor<T> space_to_batch(const SimpleTensor<T> &src, const SimpleTensor<int32_t> &block_shape, const SimpleTensor<int32_t> &paddings, const TensorShape &dst_shape)
{
- SimpleTensor<T> result(dst_shape, src.data_type());
+ SimpleTensor<T> result(dst_shape, src.data_type(), 1, src.quantization_info());
const auto width_out = static_cast<int>(dst_shape[0]);
const auto height_out = static_cast<int>(dst_shape[1]);
@@ -55,6 +55,9 @@ SimpleTensor<T> space_to_batch(const SimpleTensor<T> &src, const SimpleTensor<in
const auto padding_left = paddings[0];
const auto padding_top = paddings[2];
+ // Pad value must be logic zero
+ const auto pad_value = is_data_type_quantized(src.data_type()) ? src.quantization_info().uniform().offset : 0;
+
int out_pos = 0;
for(int outB = 0; outB < batch_out; ++outB)
{
@@ -74,7 +77,7 @@ SimpleTensor<T> space_to_batch(const SimpleTensor<T> &src, const SimpleTensor<in
if(outH * block_height + shift_h < padding_top || outH * block_height + shift_h >= padding_top + height_in || outW * block_width + shift_w < padding_left
|| outW * block_width + shift_w >= padding_left + width_in)
{
- result[out_pos] = 0;
+ result[out_pos] = pad_value;
}
else
{
@@ -90,6 +93,7 @@ SimpleTensor<T> space_to_batch(const SimpleTensor<T> &src, const SimpleTensor<in
template SimpleTensor<float> space_to_batch(const SimpleTensor<float> &src, const SimpleTensor<int32_t> &block_shape, const SimpleTensor<int32_t> &paddings, const TensorShape &dst_shape);
template SimpleTensor<half> space_to_batch(const SimpleTensor<half> &src, const SimpleTensor<int32_t> &block_shape, const SimpleTensor<int32_t> &paddings, const TensorShape &dst_shape);
+template SimpleTensor<uint8_t> space_to_batch(const SimpleTensor<uint8_t> &src, const SimpleTensor<int32_t> &block_shape, const SimpleTensor<int32_t> &paddings, const TensorShape &dst_shape);
} // namespace reference
} // namespace validation
} // namespace test