From c8d231626cc204034ab1053f9031ebbb631f1ba9 Mon Sep 17 00:00:00 2001 From: Sanghoon Lee Date: Fri, 12 Jan 2018 16:19:10 +0000 Subject: COMPMID-564: Implement reference and CL/NEON validation for CustomConvolution (output S16) Change-Id: Ic099336f558e994210a59e14ec0171fae68ccb80 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/116663 Reviewed-by: Pablo Tello Tested-by: Jenkins --- tests/validation/fixtures/ConvolutionFixture.h | 48 ++++++++++++-------------- 1 file changed, 23 insertions(+), 25 deletions(-) (limited to 'tests/validation/fixtures') diff --git a/tests/validation/fixtures/ConvolutionFixture.h b/tests/validation/fixtures/ConvolutionFixture.h index 85070cff83..4d0d7a2a6f 100644 --- a/tests/validation/fixtures/ConvolutionFixture.h +++ b/tests/validation/fixtures/ConvolutionFixture.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -46,7 +46,7 @@ class ConvolutionValidationFixture : public framework::Fixture { protected: template - void setup(TensorShape shape, DataType data_type, BorderMode border_mode, const unsigned int width, const unsigned int height, const bool is_separable = false) + void setup(TensorShape shape, DataType output_data_type, BorderMode border_mode, const unsigned int width, const unsigned int height, const bool is_separable = false) { std::mt19937 gen(library->seed()); std::uniform_int_distribution distribution(0, 255); @@ -73,8 +73,8 @@ protected: create_conv(conv); } - _target = compute_target(shape, data_type, conv, scale, border_mode, constant_border_value); - _reference = compute_reference(shape, data_type, conv, scale, border_mode, constant_border_value); + _target = compute_target(shape, output_data_type, conv, scale, border_mode, constant_border_value); + _reference = compute_reference(shape, output_data_type, conv, scale, border_mode, constant_border_value); } void @@ -122,21 +122,19 @@ protected: library->fill_tensor_uniform(tensor, i); } - SimpleTensor compute_reference(const TensorShape &shape, DataType data_type, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value) + SimpleTensor compute_reference(const TensorShape &shape, DataType output_data_type, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value) { - ARM_COMPUTE_ERROR_ON(data_type != DataType::U8); - // Create reference - SimpleTensor src{ shape, data_type }; + SimpleTensor src{ shape, DataType::U8 }; // Fill reference fill(src, 0); // Compute reference - return reference::convolution(src, conv, scale, border_mode, constant_border_value, _width, _height); + return reference::convolution(src, output_data_type, conv, scale, border_mode, constant_border_value, _width, _height); } - virtual TensorType compute_target(const TensorShape &shape, DataType data_type, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value) = 0; + virtual TensorType compute_target(const TensorShape &shape, DataType output_data_type, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value) = 0; BorderMode _border_mode{}; TensorType _target{}; @@ -150,17 +148,17 @@ class ConvolutionSquareValidationFixture : public ConvolutionValidationFixture - void setup(TensorShape shape, DataType data_type, BorderMode border_mode, const unsigned int width) + void setup(TensorShape shape, DataType output_data_type, BorderMode border_mode, const unsigned int width) { - ConvolutionValidationFixture::setup(shape, data_type, border_mode, width, width); + ConvolutionValidationFixture::setup(shape, output_data_type, border_mode, width, width); } protected: - TensorType compute_target(const TensorShape &shape, DataType data_type, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value) + TensorType compute_target(const TensorShape &shape, DataType output_data_type, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value) { // Create tensors - TensorType src = create_tensor(shape, data_type); - TensorType dst = create_tensor(shape, data_type); + TensorType src = create_tensor(shape, DataType::U8); + TensorType dst = create_tensor(shape, output_data_type); // Create and configure function FunctionType convolution; @@ -192,17 +190,17 @@ class ConvolutionSeparableValidationFixture : public ConvolutionValidationFixtur { public: template - void setup(TensorShape shape, DataType data_type, BorderMode border_mode, const unsigned int width) + void setup(TensorShape shape, DataType output_data_type, BorderMode border_mode, const unsigned int width) { - ConvolutionValidationFixture::setup(shape, data_type, border_mode, width, width, true); + ConvolutionValidationFixture::setup(shape, output_data_type, border_mode, width, width, true); } protected: - TensorType compute_target(const TensorShape &shape, DataType data_type, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value) + TensorType compute_target(const TensorShape &shape, DataType output_data_type, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value) { // Create tensors - TensorType src = create_tensor(shape, data_type); - TensorType dst = create_tensor(shape, data_type); + TensorType src = create_tensor(shape, DataType::U8); + TensorType dst = create_tensor(shape, output_data_type); // Create and configure function FunctionType convolution; @@ -234,17 +232,17 @@ class ConvolutionRectangleValidationFixture : public ConvolutionValidationFixtur { public: template - void setup(TensorShape shape, DataType data_type, BorderMode border_mode, const unsigned int width, const unsigned int height) + void setup(TensorShape shape, DataType output_data_type, BorderMode border_mode, const unsigned int width, const unsigned int height) { - ConvolutionValidationFixture::setup(shape, data_type, border_mode, width, height); + ConvolutionValidationFixture::setup(shape, output_data_type, border_mode, width, height); } protected: - TensorType compute_target(const TensorShape &shape, DataType data_type, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value) + TensorType compute_target(const TensorShape &shape, DataType output_data_type, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value) { // Create tensors - TensorType src = create_tensor(shape, data_type); - TensorType dst = create_tensor(shape, data_type); + TensorType src = create_tensor(shape, DataType::U8); + TensorType dst = create_tensor(shape, output_data_type); // Create and configure function FunctionType convolution; -- cgit v1.2.1