aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/fixtures/SpaceToBatchFixture.h
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/fixtures/SpaceToBatchFixture.h
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/fixtures/SpaceToBatchFixture.h')
-rw-r--r--tests/validation/fixtures/SpaceToBatchFixture.h59
1 files changed, 42 insertions, 17 deletions
diff --git a/tests/validation/fixtures/SpaceToBatchFixture.h b/tests/validation/fixtures/SpaceToBatchFixture.h
index a304162998..d88ecb934a 100644
--- a/tests/validation/fixtures/SpaceToBatchFixture.h
+++ b/tests/validation/fixtures/SpaceToBatchFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -36,31 +36,32 @@ namespace test
namespace validation
{
template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class SpaceToBatchLayerValidationFixture : public framework::Fixture
+class SpaceToBatchLayerValidationGenericFixture : public framework::Fixture
{
public:
template <typename...>
- void setup(TensorShape input_shape, TensorShape block_shape_shape, TensorShape paddings_shape, TensorShape output_shape, DataType data_type, DataLayout data_layout)
+ void setup(TensorShape input_shape, TensorShape block_shape_shape, TensorShape paddings_shape, TensorShape output_shape,
+ DataType data_type, DataLayout data_layout, QuantizationInfo quantization_info)
{
- _target = compute_target(input_shape, block_shape_shape, paddings_shape, output_shape, data_type, data_layout);
- _reference = compute_reference(input_shape, block_shape_shape, paddings_shape, output_shape, data_type);
+ _target = compute_target(input_shape, block_shape_shape, paddings_shape, output_shape, data_type, data_layout, quantization_info);
+ _reference = compute_reference(input_shape, block_shape_shape, paddings_shape, output_shape, data_type, quantization_info);
}
protected:
template <typename U>
void fill(U &&tensor, int i)
{
- std::uniform_real_distribution<> distribution(-1.0f, 1.0f);
- library->fill(tensor, distribution, i);
+ library->fill_tensor_uniform(tensor, i);
}
+
template <typename U>
- void fill_pad(U &&tensor, int i)
+ void fill_pad(U &&tensor)
{
- std::uniform_int_distribution<> distribution(0, 0);
- library->fill(tensor, distribution, i);
+ library->fill_tensor_value(tensor, 0);
}
+
TensorType compute_target(TensorShape input_shape, const TensorShape &block_shape_shape, const TensorShape &paddings_shape, TensorShape output_shape,
- DataType data_type, DataLayout data_layout)
+ DataType data_type, DataLayout data_layout, QuantizationInfo quantization_info)
{
if(data_layout == DataLayout::NHWC)
{
@@ -69,10 +70,10 @@ protected:
}
// Create tensors
- TensorType input = create_tensor<TensorType>(input_shape, data_type, 1, QuantizationInfo(), data_layout);
+ TensorType input = create_tensor<TensorType>(input_shape, data_type, 1, quantization_info, data_layout);
TensorType block_shape = create_tensor<TensorType>(block_shape_shape, DataType::S32);
TensorType paddings = create_tensor<TensorType>(paddings_shape, DataType::S32);
- TensorType output = create_tensor<TensorType>(output_shape, data_type, 1, QuantizationInfo(), data_layout);
+ TensorType output = create_tensor<TensorType>(output_shape, data_type, 1, quantization_info, data_layout);
// Create and configure function
FunctionType space_to_batch;
@@ -96,7 +97,7 @@ protected:
// Fill tensors
fill(AccessorType(input), 0);
- fill_pad(AccessorType(paddings), 0);
+ fill_pad(AccessorType(paddings));
{
auto block_shape_data = AccessorType(block_shape);
const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH);
@@ -112,16 +113,16 @@ protected:
}
SimpleTensor<T> compute_reference(const TensorShape &input_shape, const TensorShape &block_shape_shape, const TensorShape &paddings_shape,
- const TensorShape &output_shape, DataType data_type)
+ const TensorShape &output_shape, DataType data_type, QuantizationInfo quantization_info)
{
// Create reference
- SimpleTensor<T> input{ input_shape, data_type };
+ SimpleTensor<T> input{ input_shape, data_type, 1, quantization_info };
SimpleTensor<int32_t> block_shape{ block_shape_shape, DataType::S32 };
SimpleTensor<int32_t> paddings{ paddings_shape, DataType::S32 };
// Fill reference
fill(input, 0);
- fill_pad(paddings, 0);
+ fill_pad(paddings);
for(unsigned int i = 0; i < block_shape_shape.x(); ++i)
{
block_shape[i] = input_shape[i] / output_shape[i];
@@ -134,6 +135,30 @@ protected:
TensorType _target{};
SimpleTensor<T> _reference{};
};
+
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
+class SpaceToBatchLayerValidationFixture : public SpaceToBatchLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T>
+{
+public:
+ template <typename...>
+ void setup(TensorShape input_shape, TensorShape block_shape_shape, TensorShape paddings_shape, TensorShape output_shape,
+ DataType data_type, DataLayout data_layout)
+ {
+ SpaceToBatchLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, block_shape_shape, paddings_shape, output_shape, data_type, data_layout, QuantizationInfo());
+ }
+};
+
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
+class SpaceToBatchLayerValidationQuantizedFixture : public SpaceToBatchLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T>
+{
+public:
+ template <typename...>
+ void setup(TensorShape input_shape, TensorShape block_shape_shape, TensorShape paddings_shape, TensorShape output_shape,
+ DataType data_type, DataLayout data_layout, QuantizationInfo quantization_info)
+ {
+ SpaceToBatchLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, block_shape_shape, paddings_shape, output_shape, data_type, data_layout, quantization_info);
+ }
+};
} // namespace validation
} // namespace test
} // namespace arm_compute