aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/fixtures
diff options
context:
space:
mode:
authorMichalis Spyrou <michalis.spyrou@arm.com>2018-12-13 18:31:18 +0000
committerGeorgios Pinitas <georgios.pinitas@arm.com>2018-12-18 17:42:09 +0000
commite2588184240b4850f62859ca9f3c5e95c9d8e129 (patch)
tree4ce1b722eb6a2ca2eda2920667ea477b1c005352 /tests/validation/fixtures
parent5e96be7707a571b136dc64256af399dbbb0fdfe0 (diff)
downloadComputeLibrary-e2588184240b4850f62859ca9f3c5e95c9d8e129.tar.gz
COMPMID-1755 NEON: Extend DepthConvert to support Cast
Change-Id: I8e2ed9e97cbe86d8caf162bd84ecfd9b43b0bd3b Reviewed-on: https://review.mlplatform.org/401 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Giuseppe Rossini <giuseppe.rossini@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'tests/validation/fixtures')
-rw-r--r--tests/validation/fixtures/DepthConvertLayerFixture.h54
1 files changed, 45 insertions, 9 deletions
diff --git a/tests/validation/fixtures/DepthConvertLayerFixture.h b/tests/validation/fixtures/DepthConvertLayerFixture.h
index 29034c5334..a3d379eede 100644
--- a/tests/validation/fixtures/DepthConvertLayerFixture.h
+++ b/tests/validation/fixtures/DepthConvertLayerFixture.h
@@ -41,29 +41,40 @@ namespace test
namespace validation
{
template <typename TensorType, typename AccessorType, typename FunctionType, typename T1, typename T2>
-class DepthConvertLayerValidationFixture : public framework::Fixture
+class DepthConvertLayerValidationBaseFixture : public framework::Fixture
{
public:
template <typename...>
- void setup(TensorShape shape, DataType dt_in, DataType dt_out, ConvertPolicy policy, uint32_t shift)
+ void setup(TensorShape shape, DataType dt_in, DataType dt_out, ConvertPolicy policy, uint32_t shift, QuantizationInfo quantization_info)
{
- _shift = shift;
- _target = compute_target(shape, dt_in, dt_out, policy, shift);
- _reference = compute_reference(shape, dt_in, dt_out, policy, shift);
+ _shift = shift;
+ _quantization_info = quantization_info;
+ _target = compute_target(shape, dt_in, dt_out, policy, shift);
+ _reference = compute_reference(shape, dt_in, dt_out, policy, shift);
}
protected:
template <typename U>
void fill(U &&tensor, int i)
{
- library->fill_tensor_uniform(tensor, i);
+ if(is_data_type_quantized(tensor.data_type()))
+ {
+ std::pair<int, int> bounds = get_quantized_bounds(tensor.quantization_info(), -1.0f, 1.0f);
+ std::uniform_int_distribution<uint8_t> distribution(bounds.first, bounds.second);
+
+ library->fill(tensor, distribution, i);
+ }
+ else
+ {
+ library->fill_tensor_uniform(tensor, i);
+ }
}
TensorType compute_target(const TensorShape &shape, DataType dt_in, DataType dt_out, ConvertPolicy policy, uint32_t shift)
{
// Create tensors
- TensorType src = create_tensor<TensorType>(shape, dt_in, 1);
- TensorType dst = create_tensor<TensorType>(shape, dt_out, 1);
+ TensorType src = create_tensor<TensorType>(shape, dt_in, 1, _quantization_info);
+ TensorType dst = create_tensor<TensorType>(shape, dt_out, 1, _quantization_info);
// Create and configure function
FunctionType depth_convert;
@@ -91,7 +102,7 @@ protected:
SimpleTensor<T2> compute_reference(const TensorShape &shape, DataType dt_in, DataType dt_out, ConvertPolicy policy, uint32_t shift)
{
// Create reference
- SimpleTensor<T1> src{ shape, dt_in, 1 };
+ SimpleTensor<T1> src{ shape, dt_in, 1, _quantization_info };
// Fill reference
fill(src, 0);
@@ -102,6 +113,31 @@ protected:
TensorType _target{};
SimpleTensor<T2> _reference{};
int _shift{};
+ QuantizationInfo _quantization_info{};
+};
+
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T1, typename T2>
+class DepthConvertLayerValidationFixture : public DepthConvertLayerValidationBaseFixture<TensorType, AccessorType, FunctionType, T1, T2>
+{
+public:
+ template <typename...>
+ void setup(TensorShape shape, DataType dt_in, DataType dt_out, ConvertPolicy policy, uint32_t shift)
+ {
+ DepthConvertLayerValidationBaseFixture<TensorType, AccessorType, FunctionType, T1, T2>::setup(shape, dt_in, dt_out, policy,
+ shift, QuantizationInfo());
+ }
+};
+
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T1, typename T2>
+class DepthConvertLayerValidationQuantizedFixture : public DepthConvertLayerValidationBaseFixture<TensorType, AccessorType, FunctionType, T1, T2>
+{
+public:
+ template <typename...>
+ void setup(TensorShape shape, DataType dt_in, DataType dt_out, ConvertPolicy policy, uint32_t shift, QuantizationInfo quantization_info)
+ {
+ DepthConvertLayerValidationBaseFixture<TensorType, AccessorType, FunctionType, T1, T2>::setup(shape, dt_in, dt_out, policy,
+ shift, quantization_info);
+ }
};
} // namespace validation
} // namespace test