diff options
Diffstat (limited to 'tests/validation/reference')
28 files changed, 101 insertions, 75 deletions
diff --git a/tests/validation/reference/Box3x3.cpp b/tests/validation/reference/Box3x3.cpp index 8d304a8236..153f26a5c6 100644 --- a/tests/validation/reference/Box3x3.cpp +++ b/tests/validation/reference/Box3x3.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -39,8 +39,9 @@ SimpleTensor<T> box3x3(const SimpleTensor<T> &src, BorderMode border_mode, T con { SimpleTensor<T> dst(src.shape(), src.data_type()); const std::array<T, 9> filter{ { 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - const float scale = 1.f / static_cast<float>(filter.size()); - for(int element_idx = 0; element_idx < src.num_elements(); ++element_idx) + const float scale = 1.f / static_cast<float>(filter.size()); + const uint32_t num_elements = src.num_elements(); + for(uint32_t element_idx = 0; element_idx < num_elements; ++element_idx) { const Coordinates id = index2coord(src.shape(), element_idx); apply_2d_spatial_filter(id, src, dst, TensorShape(3U, 3U), filter.data(), scale, border_mode, constant_border_value); diff --git a/tests/validation/reference/ChannelCombine.cpp b/tests/validation/reference/ChannelCombine.cpp index b76dcaca8c..a6c0557b79 100644 --- a/tests/validation/reference/ChannelCombine.cpp +++ b/tests/validation/reference/ChannelCombine.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -94,9 +94,10 @@ std::vector<SimpleTensor<T>> channel_combine(const TensorShape &shape, const std for(unsigned int plane_idx = 0; plane_idx < dst.size(); ++plane_idx) { - SimpleTensor<T> &dst_tensor = dst[plane_idx]; + SimpleTensor<T> &dst_tensor = dst[plane_idx]; + const uint32_t num_elements = dst_tensor.num_elements(); - for(int element_idx = 0; element_idx < dst_tensor.num_elements(); ++element_idx) + for(uint32_t element_idx = 0; element_idx < num_elements; ++element_idx) { Coordinates coord = index2coord(dst_tensor.shape(), element_idx); diff --git a/tests/validation/reference/ConvertFullyConnectedWeights.cpp b/tests/validation/reference/ConvertFullyConnectedWeights.cpp index e27846c726..5925496f45 100644 --- a/tests/validation/reference/ConvertFullyConnectedWeights.cpp +++ b/tests/validation/reference/ConvertFullyConnectedWeights.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -48,7 +48,8 @@ SimpleTensor<T> convert_fully_connected_weights(const SimpleTensor<T> &src, cons const unsigned int factor_1 = is_nchw_to_nhwc ? num_elems_per_input_plane : num_channels; const unsigned int factor_2 = is_nchw_to_nhwc ? num_channels : num_elems_per_input_plane; - for(int i = 0; i < src.num_elements(); ++i) + const uint32_t num_elements = src.num_elements(); + for(uint32_t i = 0; i < num_elements; ++i) { const Coordinates coords_in = index2coords(src.shape(), i); const Coordinates coords_out(coords_in.x(), coords_in.y() % factor_1 * factor_2 + coords_in.y() / factor_1); diff --git a/tests/validation/reference/Convolution.cpp b/tests/validation/reference/Convolution.cpp index e3d4b4ac1e..1083d50e0d 100644 --- a/tests/validation/reference/Convolution.cpp +++ b/tests/validation/reference/Convolution.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -44,8 +44,8 @@ SimpleTensor<T> convolution(const SimpleTensor<uint8_t> &src, DataType output_da SimpleTensor<T> dst(src.shape(), output_data_type); SimpleTensor<int32_t> sum(src.shape(), output_data_type); - - for(int element_idx = 0; element_idx < src.num_elements(); ++element_idx) + const uint32_t num_elements = src.num_elements(); + for(uint32_t element_idx = 0; element_idx < num_elements; ++element_idx) { const Coordinates id = index2coord(src.shape(), element_idx); apply_2d_spatial_filter(id, src, sum, TensorShape(width, height), conv, 1, border_mode, constant_border_value); diff --git a/tests/validation/reference/CropResize.cpp b/tests/validation/reference/CropResize.cpp index f25a0317be..68ee4557fb 100644 --- a/tests/validation/reference/CropResize.cpp +++ b/tests/validation/reference/CropResize.cpp @@ -123,7 +123,7 @@ SimpleTensor<float> scale_image(const SimpleTensor<float> &in, const TensorShape template <typename T> SimpleTensor<float> crop_image(const SimpleTensor<T> &src, Coordinates start, Coordinates end, int32_t batch_index, float extrapolation_value) { - TensorShape out_shape(src.shape()[0], abs(end[0] - start[0]) + 1, abs(end[1] - start[1]) + 1); + TensorShape out_shape(src.shape()[0], static_cast<uint32_t>(abs(end[0] - start[0])) + 1, static_cast<uint32_t>(abs(end[1] - start[1])) + 1); SimpleTensor<float> out{ out_shape, DataType::F32, 1, QuantizationInfo(), DataLayout::NHWC }; diff --git a/tests/validation/reference/DFT.cpp b/tests/validation/reference/DFT.cpp index 6ad1b9e150..b3c2c6b0b9 100644 --- a/tests/validation/reference/DFT.cpp +++ b/tests/validation/reference/DFT.cpp @@ -237,11 +237,11 @@ void scale(SimpleTensor<T> &tensor, T scaling_factor) template <typename T> SimpleTensor<T> complex_mul_and_reduce(const SimpleTensor<T> &input, const SimpleTensor<T> &weights) { - const int W = input.shape().x(); - const int H = input.shape().y(); - const int Ci = input.shape().z(); - const int Co = weights.shape()[3]; - const int N = input.shape().total_size() / (W * H * Ci); + const uint32_t W = input.shape().x(); + const uint32_t H = input.shape().y(); + const uint32_t Ci = input.shape().z(); + const uint32_t Co = weights.shape()[3]; + const uint32_t N = input.shape().total_size() / (W * H * Ci); TensorShape output_shape = input.shape(); output_shape.set(2, Co); @@ -250,19 +250,19 @@ SimpleTensor<T> complex_mul_and_reduce(const SimpleTensor<T> &input, const Simpl // MemSet dst memory to zero std::memset(dst.data(), 0, dst.size()); - for(int b = 0; b < N; ++b) + for(uint32_t b = 0; b < N; ++b) { - for(int co = 0; co < Co; ++co) + for(uint32_t co = 0; co < Co; ++co) { - for(int ci = 0; ci < Ci; ++ci) + for(uint32_t ci = 0; ci < Ci; ++ci) { - for(int h = 0; h < H; ++h) + for(uint32_t h = 0; h < H; ++h) { - for(int w = 0; w < W; ++w) + for(uint32_t w = 0; w < W; ++w) { - size_t i_index = w + h * W + ci * H * W + b * H * W * Ci; - size_t w_index = w + h * W + ci * H * W + co * H * W * Ci; - size_t o_index = w + h * W + co * H * W + b * H * W * Co; + const uint32_t i_index = w + h * W + ci * H * W + b * H * W * Ci; + const uint32_t w_index = w + h * W + ci * H * W + co * H * W * Ci; + const uint32_t o_index = w + h * W + co * H * W + b * H * W * Co; const Coordinates i_coords = index2coords(input.shape(), i_index); const Coordinates w_coords = index2coords(weights.shape(), w_index); const Coordinates o_coords = index2coords(dst.shape(), o_index); diff --git a/tests/validation/reference/Derivative.cpp b/tests/validation/reference/Derivative.cpp index 0ef8fc276d..3c6f3259b2 100644 --- a/tests/validation/reference/Derivative.cpp +++ b/tests/validation/reference/Derivative.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -61,7 +61,8 @@ std::pair<SimpleTensor<T>, SimpleTensor<T>> derivative(const SimpleTensor<U> &sr ValidRegion valid_region = shape_to_valid_region(src.shape(), border_mode == BorderMode::UNDEFINED, BorderSize(filter_size / 2)); - for(int i = 0; i < src.num_elements(); ++i) + const uint32_t num_elements = src.num_elements(); + for(uint32_t i = 0; i < num_elements; ++i) { Coordinates coord = index2coord(src.shape(), i); diff --git a/tests/validation/reference/Dilate.cpp b/tests/validation/reference/Dilate.cpp index 0683a0a9a1..8e244e9b7b 100644 --- a/tests/validation/reference/Dilate.cpp +++ b/tests/validation/reference/Dilate.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -50,8 +50,9 @@ SimpleTensor<T> dilate(const SimpleTensor<T> &src, BorderMode border_mode, T con dst(x, y) = max[ src(x', y') for x-1<=x'<=x+1, y-1<=y'<=y+1 ] = max({tl, tc, tr, ml, xy, mr, bl, bc, br}) */ SimpleTensor<T> dst(src.shape(), src.data_type()); + const uint32_t num_elements = src.num_elements(); - for(int i = 0; i < src.num_elements(); ++i) + for(uint32_t i = 0; i < num_elements; ++i) { Coordinates coord = index2coord(src.shape(), i); const int x = coord.x(); diff --git a/tests/validation/reference/Erode.cpp b/tests/validation/reference/Erode.cpp index 5e8b36f47b..e7598c3900 100644 --- a/tests/validation/reference/Erode.cpp +++ b/tests/validation/reference/Erode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -51,7 +51,8 @@ SimpleTensor<T> erode(const SimpleTensor<T> &src, BorderMode border_mode, T cons */ SimpleTensor<T> dst(src.shape(), src.data_type()); - for(int i = 0; i < src.num_elements(); ++i) + const uint32_t num_elements = src.num_elements(); + for(uint32_t i = 0; i < num_elements; ++i) { Coordinates coord = index2coord(src.shape(), i); const int x = coord.x(); diff --git a/tests/validation/reference/FastCorners.cpp b/tests/validation/reference/FastCorners.cpp index bcea3f10b1..32b911573b 100644 --- a/tests/validation/reference/FastCorners.cpp +++ b/tests/validation/reference/FastCorners.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -167,7 +167,8 @@ std::vector<KeyPoint> fast_corners(const SimpleTensor<T> &src, float input_thres SimpleTensor<uint8_t> scores(src.shape(), DataType::U8); ValidRegion valid_region = shape_to_valid_region(src.shape(), BorderMode::UNDEFINED == border_mode, BorderSize(bresenham_radius)); - for(int i = 0; i < src.num_elements(); ++i) + const uint32_t num_elements = src.num_elements(); + for(uint32_t i = 0; i < num_elements; ++i) { Coordinates candidate = index2coord(src.shape(), i); scores[i] = 0; diff --git a/tests/validation/reference/Gaussian3x3.cpp b/tests/validation/reference/Gaussian3x3.cpp index c71eade5c1..5ca24a7961 100644 --- a/tests/validation/reference/Gaussian3x3.cpp +++ b/tests/validation/reference/Gaussian3x3.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -39,8 +39,10 @@ SimpleTensor<T> gaussian3x3(const SimpleTensor<T> &src, BorderMode border_mode, { SimpleTensor<T> dst(src.shape(), src.data_type()); const std::array<T, 9> filter{ { 1, 2, 1, 2, 4, 2, 1, 2, 1 } }; - const float scale = 1.f / 16.f; - for(int element_idx = 0; element_idx < src.num_elements(); ++element_idx) + const float scale = 1.f / 16.f; + const uint32_t num_elements = src.num_elements(); + + for(uint32_t element_idx = 0; element_idx < num_elements; ++element_idx) { const Coordinates id = index2coord(src.shape(), element_idx); apply_2d_spatial_filter(id, src, dst, TensorShape(3U, 3U), filter.data(), scale, border_mode, constant_border_value); diff --git a/tests/validation/reference/Gaussian5x5.cpp b/tests/validation/reference/Gaussian5x5.cpp index 55bb287fbe..ac84f6d097 100644 --- a/tests/validation/reference/Gaussian5x5.cpp +++ b/tests/validation/reference/Gaussian5x5.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -45,8 +45,10 @@ SimpleTensor<T> gaussian5x5(const SimpleTensor<T> &src, BorderMode border_mode, 4, 16, 24, 16, 4, 1, 4, 6, 4, 1 } }; - const float scale = 1.f / 256.f; - for(int element_idx = 0; element_idx < src.num_elements(); ++element_idx) + const float scale = 1.f / 256.f; + const uint32_t num_elements = src.num_elements(); + + for(uint32_t element_idx = 0; element_idx < num_elements; ++element_idx) { const Coordinates id = index2coord(src.shape(), element_idx); apply_2d_spatial_filter(id, src, dst, TensorShape(5U, 5U), filter.data(), scale, border_mode, constant_border_value); diff --git a/tests/validation/reference/HOGDescriptor.cpp b/tests/validation/reference/HOGDescriptor.cpp index ed22695793..f0f573a471 100644 --- a/tests/validation/reference/HOGDescriptor.cpp +++ b/tests/validation/reference/HOGDescriptor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -69,7 +69,7 @@ void hog_orientation_compute(const SimpleTensor<T> &mag, const SimpleTensor<T> & } template <typename T> -void hog_block_normalization_compute(SimpleTensor<T> &block, SimpleTensor<T> &desc, const HOGInfo &hog_info, size_t block_idx) +void hog_block_normalization_compute(SimpleTensor<T> &block, SimpleTensor<T> &desc, const HOGInfo &hog_info, uint32_t block_idx) { const int num_bins_per_block = desc.num_channels(); const HOGNormType norm_type = hog_info.normalization_type(); @@ -186,8 +186,8 @@ void hog_block_normalization(SimpleTensor<T> &desc, const SimpleTensor<T> &hog_s // Tensor representing single block SimpleTensor<T> block(TensorShape{ 1u, 1u }, DataType::F32, cells_per_block.area() * num_bins); - int block_idx = 0; - int block_y_offset = 0; + uint32_t block_idx = 0; + int block_y_offset = 0; // Traverse shape for(auto sy = block_size.height; sy <= shape_height; sy += block_stride.height) diff --git a/tests/validation/reference/Median3x3.cpp b/tests/validation/reference/Median3x3.cpp index 91a787a0a3..314bbe38e6 100644 --- a/tests/validation/reference/Median3x3.cpp +++ b/tests/validation/reference/Median3x3.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -45,8 +45,9 @@ SimpleTensor<T> median3x3(const SimpleTensor<T> &src, BorderMode border_mode, T { SimpleTensor<T> dst(src.shape(), src.data_type()); const int size_tot_filter = filter_size * filter_size; + const uint32_t num_elements = src.num_elements(); - for(int src_idx = 0; src_idx < src.num_elements(); ++src_idx) + for(uint32_t src_idx = 0; src_idx < num_elements; ++src_idx) { std::array<T, size_tot_filter> filter_elems = { { 0 } }; Coordinates id = index2coord(src.shape(), src_idx); diff --git a/tests/validation/reference/NonLinearFilter.cpp b/tests/validation/reference/NonLinearFilter.cpp index 8669c9c776..72433ebe54 100644 --- a/tests/validation/reference/NonLinearFilter.cpp +++ b/tests/validation/reference/NonLinearFilter.cpp @@ -1,24 +1,24 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to - * deal src the Software without restriction, including without limitation the + * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included src all + * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. src NO EVENT SHALL THE + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER src AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * dst OF OR src CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include "NonLinearFilter.h" @@ -49,8 +49,9 @@ SimpleTensor<T> non_linear_filter(const SimpleTensor<T> &src, NonLinearFilterFun intermediate_type current_value = 0; const ValidRegion valid_region = shape_to_valid_region(src.shape(), border_mode == BorderMode::UNDEFINED, BorderSize(half_mask_size)); + const uint32_t num_elements = src.num_elements(); - for(int element_idx = 0, count = 0, index = 0; element_idx < src.num_elements(); ++element_idx, count = 0, index = 0) + for(uint32_t element_idx = 0, count = 0, index = 0; element_idx < num_elements; ++element_idx, count = 0, index = 0) { Coordinates id = index2coord(src.shape(), element_idx); if(is_in_valid_region(valid_region, id)) diff --git a/tests/validation/reference/NonMaximaSuppression.cpp b/tests/validation/reference/NonMaximaSuppression.cpp index 34c6c07abc..45ce67f699 100644 --- a/tests/validation/reference/NonMaximaSuppression.cpp +++ b/tests/validation/reference/NonMaximaSuppression.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -41,7 +41,8 @@ SimpleTensor<T> non_maxima_suppression(const SimpleTensor<T> &src, BorderMode bo SimpleTensor<T> dst(src.shape(), src.data_type(), src.num_channels()); ValidRegion valid_region = shape_to_valid_region(src.shape(), border_mode == BorderMode::UNDEFINED, BorderSize(block_size / 2)); - for(int i = 0; i < src.num_elements(); ++i) + const uint32_t num_elements = src.num_elements(); + for(uint32_t i = 0; i < num_elements; ++i) { Coordinates coord = index2coord(src.shape(), i); int x = coord.x(); diff --git a/tests/validation/reference/PadLayer.cpp b/tests/validation/reference/PadLayer.cpp index 700e8f8ccf..182c16fb4e 100644 --- a/tests/validation/reference/PadLayer.cpp +++ b/tests/validation/reference/PadLayer.cpp @@ -54,7 +54,8 @@ SimpleTensor<T> pad_layer(const SimpleTensor<T> &src, const PaddingList &padding SimpleTensor<T> dst(padded_shape, dst_data_type); // Reference algorithm: loop over the different dimension of the input. - for(int idx = 0; idx < dst.num_elements(); ++idx) + const uint32_t num_elements = dst.num_elements(); + for(uint32_t idx = 0; idx < num_elements; ++idx) { const Coordinates coord = index2coord(padded_shape, idx); diff --git a/tests/validation/reference/Permute.cpp b/tests/validation/reference/Permute.cpp index 619a787a05..36b07dc277 100644 --- a/tests/validation/reference/Permute.cpp +++ b/tests/validation/reference/Permute.cpp @@ -45,7 +45,8 @@ SimpleTensor<T> permute(const SimpleTensor<T> &src, PermutationVector perm) SimpleTensor<T> dst{ dst_shape, src.data_type(), src.num_channels(), src.quantization_info() }; // Compute reference - for(int i = 0; i < src.num_elements(); ++i) + const uint32_t num_elements = src.num_elements(); + for(uint32_t i = 0; i < num_elements; ++i) { const Coordinates src_coords = index2coord(src.shape(), i); Coordinates dst_coords = src_coords; diff --git a/tests/validation/reference/Remap.cpp b/tests/validation/reference/Remap.cpp index f862c13700..a7352eb3a3 100644 --- a/tests/validation/reference/Remap.cpp +++ b/tests/validation/reference/Remap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -44,9 +44,10 @@ SimpleTensor<T> remap(const SimpleTensor<T> &in, SimpleTensor<float> &map_x, Sim ARM_COMPUTE_ERROR_ON_MSG(border_mode == BorderMode::REPLICATE, "BorderMode not supported"); SimpleTensor<T> out(in.shape(), in.data_type()); ARM_COMPUTE_ERROR_ON(out.num_elements() != map_x.num_elements()); - const int width = in.shape().x(); - const int height = in.shape().y(); - for(int idx = 0; idx < out.num_elements(); idx++) + const int width = in.shape().x(); + const int height = in.shape().y(); + const uint32_t num_elements = out.num_elements(); + for(uint32_t idx = 0; idx < num_elements; idx++) { const Coordinates id_out = index2coord(out.shape(), idx); valid_mask[idx] = 1; diff --git a/tests/validation/reference/Reverse.cpp b/tests/validation/reference/Reverse.cpp index 1662dc24a0..4bd8efc6a8 100644 --- a/tests/validation/reference/Reverse.cpp +++ b/tests/validation/reference/Reverse.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -54,7 +54,8 @@ SimpleTensor<T> reverse(const SimpleTensor<T> &src, const SimpleTensor<uint32_t> to_reverse[axis[i]] = true; } - for(int i = 0; i < src.num_elements(); ++i) + const uint32_t num_elements = src.num_elements(); + for(uint32_t i = 0; i < num_elements; ++i) { const Coordinates src_coord = index2coord(src.shape(), i); const unsigned int dst_x = to_reverse[0] ? width - src_coord[0] - 1 : src_coord[0]; diff --git a/tests/validation/reference/Scale.cpp b/tests/validation/reference/Scale.cpp index 4405e79263..7962459ce8 100644 --- a/tests/validation/reference/Scale.cpp +++ b/tests/validation/reference/Scale.cpp @@ -63,7 +63,8 @@ SimpleTensor<T> scale_core(const SimpleTensor<T> &in, float scale_x, float scale policy = InterpolationPolicy::NEAREST_NEIGHBOR; } - for(int element_idx = 0, count = 0; element_idx < out.num_elements(); ++element_idx, ++count) + const uint32_t num_elements = out.num_elements(); + for(uint32_t element_idx = 0, count = 0; element_idx < num_elements; ++element_idx, ++count) { Coordinates id = index2coord(out.shape(), element_idx); int idx = id.x(); diff --git a/tests/validation/reference/Scharr.cpp b/tests/validation/reference/Scharr.cpp index 98e4d62dba..060192b74c 100644 --- a/tests/validation/reference/Scharr.cpp +++ b/tests/validation/reference/Scharr.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -68,7 +68,8 @@ std::pair<SimpleTensor<T>, SimpleTensor<T>> scharr(const SimpleTensor<U> &src, i ValidRegion valid_region = shape_to_valid_region(src.shape(), border_mode == BorderMode::UNDEFINED, BorderSize(filter_size / 2)); - for(int i = 0; i < src.num_elements(); ++i) + const uint32_t num_elements = src.num_elements(); + for(uint32_t i = 0; i < num_elements; ++i) { Coordinates coord = index2coord(src.shape(), i); diff --git a/tests/validation/reference/Sobel.cpp b/tests/validation/reference/Sobel.cpp index 233f1ad4fc..1f35717fb9 100644 --- a/tests/validation/reference/Sobel.cpp +++ b/tests/validation/reference/Sobel.cpp @@ -110,7 +110,8 @@ std::pair<SimpleTensor<T>, SimpleTensor<T>> sobel(const SimpleTensor<U> &src, in ValidRegion valid_region = shape_to_valid_region(src.shape(), border_mode == BorderMode::UNDEFINED, BorderSize(filter_size / 2)); - for(int i = 0; i < src.num_elements(); ++i) + const uint32_t num_elements = src.num_elements(); + for(uint32_t i = 0; i < num_elements; ++i) { Coordinates coord = index2coord(src.shape(), i); diff --git a/tests/validation/reference/Tile.cpp b/tests/validation/reference/Tile.cpp index e87e515a51..694f645007 100644 --- a/tests/validation/reference/Tile.cpp +++ b/tests/validation/reference/Tile.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -43,7 +43,8 @@ SimpleTensor<T> tile(const SimpleTensor<T> &src, const Multiples &multiples) SimpleTensor<T> dst{ tiled_shape, src.data_type() }; - for(int idx = 0; idx < dst.num_elements(); idx++) + const uint32_t num_elements = dst.num_elements(); + for(uint32_t idx = 0; idx < num_elements; idx++) { Coordinates coord = index2coord(tiled_shape, idx); diff --git a/tests/validation/reference/Transpose.cpp b/tests/validation/reference/Transpose.cpp index 348c7030cb..a8c0e95322 100644 --- a/tests/validation/reference/Transpose.cpp +++ b/tests/validation/reference/Transpose.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -44,7 +44,8 @@ SimpleTensor<T> transpose(const SimpleTensor<T> &src) SimpleTensor<T> dst{ dst_shape, src.data_type() }; // Compute reference - for(int i = 0; i < src.num_elements(); ++i) + const uint32_t num_elements = src.num_elements(); + for(uint32_t i = 0; i < num_elements; ++i) { const Coordinates coord = index2coord(src.shape(), i); const Coordinates dst_coord{ coord.y(), coord.x() }; diff --git a/tests/validation/reference/WarpAffine.cpp b/tests/validation/reference/WarpAffine.cpp index 7b903b7661..2a7aeb7cc2 100644 --- a/tests/validation/reference/WarpAffine.cpp +++ b/tests/validation/reference/WarpAffine.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -63,7 +63,8 @@ SimpleTensor<T> warp_affine(const SimpleTensor<T> &src, SimpleTensor<T> &valid_m const int width = src.shape().x(); const int height = src.shape().y(); - for(int element_idx = 0; element_idx < src.num_elements(); ++element_idx) + const uint32_t num_elements = src.num_elements(); + for(uint32_t element_idx = 0; element_idx < num_elements; ++element_idx) { valid_mask[element_idx] = 1; Coordinates id = index2coord(src.shape(), element_idx); diff --git a/tests/validation/reference/WarpPerspective.cpp b/tests/validation/reference/WarpPerspective.cpp index 7a50253d69..dc7420b93b 100644 --- a/tests/validation/reference/WarpPerspective.cpp +++ b/tests/validation/reference/WarpPerspective.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -57,7 +57,8 @@ SimpleTensor<T> warp_perspective(const SimpleTensor<T> &src, SimpleTensor<T> &va const int width = src.shape().x(); const int height = src.shape().y(); - for(int element_idx = 0; element_idx < src.num_elements(); ++element_idx) + const uint32_t num_elements = src.num_elements(); + for(uint32_t element_idx = 0; element_idx < num_elements; ++element_idx) { valid_mask[element_idx] = 1; Coordinates id = index2coord(src.shape(), element_idx); diff --git a/tests/validation/reference/YOLOLayer.cpp b/tests/validation/reference/YOLOLayer.cpp index cf5e256cf9..0011b85c1e 100644 --- a/tests/validation/reference/YOLOLayer.cpp +++ b/tests/validation/reference/YOLOLayer.cpp @@ -46,7 +46,8 @@ SimpleTensor<T> yolo_layer(const SimpleTensor<T> &src, const ActivationLayerInfo const T a(info.a()); const T b(info.b()); - for(int i = 0; i < src.num_elements(); ++i) + const uint32_t num_elements = src.num_elements(); + for(uint32_t i = 0; i < num_elements; ++i) { const size_t z = index2coord(dst.shape(), i).z() % (num_classes + 5); |