aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/fixtures/ConvolutionFixture.h
diff options
context:
space:
mode:
authorJohn Richardson <john.richardson@arm.com>2018-06-05 12:47:20 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:53:09 +0000
commit32af1f8ed8466647abb4f0532c70f72530a1a9ca (patch)
tree41d32d89a3b1315bc84dd7b0c416e181029ae3c1 /tests/validation/fixtures/ConvolutionFixture.h
parent80127549c3fabc941e6dcb5e61136ecb20f9c735 (diff)
downloadComputeLibrary-32af1f8ed8466647abb4f0532c70f72530a1a9ca.tar.gz
COMPMID-761: Add CL/NEON Convolution benchmark tests
Change-Id: I684baff3bfdff2244e04facd2d85d84609b7caff Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/134769 Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Tested-by: Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/validation/fixtures/ConvolutionFixture.h')
-rw-r--r--tests/validation/fixtures/ConvolutionFixture.h43
1 files changed, 2 insertions, 41 deletions
diff --git a/tests/validation/fixtures/ConvolutionFixture.h b/tests/validation/fixtures/ConvolutionFixture.h
index 8ebb924c65..741ebe5eb9 100644
--- a/tests/validation/fixtures/ConvolutionFixture.h
+++ b/tests/validation/fixtures/ConvolutionFixture.h
@@ -66,56 +66,17 @@ protected:
if(is_separable)
{
- create_separable_conv(conv.data());
+ init_separable_conv(conv.data(), width, height, library->seed());
}
else
{
- create_conv(conv.data());
+ init_conv(conv.data(), width, height, library->seed());
}
_target = compute_target(shape, output_data_type, conv.data(), scale, border_mode, constant_border_value);
_reference = compute_reference(shape, output_data_type, conv.data(), scale, border_mode, constant_border_value);
}
- void
- create_conv(int16_t *conv)
- {
- std::mt19937 gen(library->seed());
- std::uniform_int_distribution<int16_t> distribution_int16(-32768, 32767);
-
- for(unsigned int i = 0; i < _width * _height; ++i)
- {
- conv[i] = distribution_int16(gen);
- }
- }
-
- void
- create_separable_conv(int16_t *conv)
- {
- std::mt19937 gen(library->seed());
- // Set it between -128 and 127 to ensure the matrix does not overflow
- std::uniform_int_distribution<int16_t> distribution_int16(-128, 127);
-
- int16_t conv_row[_width];
- int16_t conv_col[_height];
-
- conv_row[0] = conv_col[0] = 1;
- for(unsigned int i = 1; i < _width; ++i)
- {
- conv_row[i] = distribution_int16(gen);
- conv_col[i] = distribution_int16(gen);
- }
-
- // Multiply two matrices
- for(unsigned int i = 0; i < _width; ++i)
- {
- for(unsigned int j = 0; j < _height; ++j)
- {
- conv[i * _width + j] = conv_col[i] * conv_row[j];
- }
- }
- }
-
template <typename U>
void fill(U &&tensor, int i)
{