diff options
author | Pablo Tello <pablo.tello@arm.com> | 2017-10-25 11:40:50 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:35:24 +0000 |
commit | daaa1fa506834c9d9ff44e5b38f05781ec416912 (patch) | |
tree | b77c41aff17d371596f5d579289a3e07cd33b0bc /tests/validation/CPP | |
parent | 81a26ad6b626ce2da83659d7c6c17b6104d1f203 (diff) | |
download | ComputeLibrary-daaa1fa506834c9d9ff44e5b38f05781ec416912.tar.gz |
COMPMID-642: Fixed mismatches in NEDeconvolutionLayer.
Mismatches are caused by an incorrect implementation of round() in support/ToolchainSupport.h.
The current implementation produces incorrect results in aarch64 linux targets( e.g round(0.5) = 0)
Change-Id: I5448d9860f9994745466ba074ade92467508817a
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/93032
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'tests/validation/CPP')
-rw-r--r-- | tests/validation/CPP/DeconvolutionLayer.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/validation/CPP/DeconvolutionLayer.cpp b/tests/validation/CPP/DeconvolutionLayer.cpp index 34f3d10edb..82c2188ade 100644 --- a/tests/validation/CPP/DeconvolutionLayer.cpp +++ b/tests/validation/CPP/DeconvolutionLayer.cpp @@ -49,8 +49,8 @@ SimpleTensor<T> deconvolution_layer(const SimpleTensor<T> &src, const SimpleTens const int width_scaled = scaled.shape().x(); const int height_scaled = scaled.shape().y(); const int num_2d_slices = src.shape().total_size() / (width_in * height_in); - const auto width_ratio = static_cast<float>(width_in) / static_cast<float>(width_scaled); - const auto height_ratio = static_cast<float>(height_in) / static_cast<float>(height_scaled); + const float width_ratio = static_cast<float>(width_in) / static_cast<float>(width_scaled); + const float height_ratio = static_cast<float>(height_in) / static_cast<float>(height_scaled); const int ax = a.first; // The number of zeros added to right edge of the input. const int ay = a.second; // The number of zeros added to bottom edge of the input. const unsigned int kernel_size = weights.shape().x(); @@ -59,7 +59,6 @@ SimpleTensor<T> deconvolution_layer(const SimpleTensor<T> &src, const SimpleTens const int transposed_convolution_pady = kernel_size - info.pad().second - 1; const int stridex = info.stride().first; const int stridey = info.stride().second; - for(int j = 0; j < scaled.num_elements(); ++j) { scaled[j] = T(0); @@ -83,8 +82,8 @@ SimpleTensor<T> deconvolution_layer(const SimpleTensor<T> &src, const SimpleTens { if(in_bounds) { - const int in_scaled_x = support::cpp11::round(x_src); - const int in_scaled_y = support::cpp11::round(y_src); + const int in_scaled_x = (x_src < 0.f) ? static_cast<int>(x_src - 0.5f) : static_cast<int>(x_src + 0.5f); + const int in_scaled_y = (y_src < 0.f) ? static_cast<int>(y_src - 0.5f) : static_cast<int>(y_src + 0.5f); const T *in = src.data() + offset_slice_in + in_scaled_x + in_scaled_y * width_in; *out = *in; } |