aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichalis Spyrou <michalis.spyrou@arm.com>2019-10-16 17:41:33 +0100
committerMichalis Spyrou <michalis.spyrou@arm.com>2019-10-17 15:36:33 +0000
commitfae513c5585b9ba09c3aa8bfd4f7119208b7b5f9 (patch)
tree4c87da93a765e880d22a53904543e2e91660f7a5
parentebaddb600795911dc4e4c446d4f612caa009aaa1 (diff)
downloadComputeLibrary-fae513c5585b9ba09c3aa8bfd4f7119208b7b5f9.tar.gz
COMPMID-2486: Remove/add disabled compiler warnings
Removed the following flags: -Wno-vla -Wno-strict-overflow Added: -Wformat-security Change-Id: I49eb3d724e14db796e543164295674617c37cb65 Signed-off-by: Michalis Spyrou <michalis.spyrou@arm.com> Reviewed-on: https://review.mlplatform.org/c/2109 Tested-by: Arm Jenkins <bsgcomp@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
-rw-r--r--SConstruct4
-rw-r--r--src/core/NEON/kernels/NEScaleKernel.cpp2
-rw-r--r--src/core/utils/helpers/tensor_transform.cpp9
-rw-r--r--src/runtime/CL/functions/CLCropResize.cpp2
-rw-r--r--tests/AssetsLibrary.h11
-rw-r--r--tests/Utils.h7
-rw-r--r--tests/framework/instruments/MaliCounter.cpp4
-rw-r--r--tests/framework/instruments/MaliCounter.h4
-rw-r--r--tests/validation/Validation.cpp5
-rw-r--r--tests/validation/Validation.h32
-rw-r--r--tests/validation/reference/Box3x3.cpp7
-rw-r--r--tests/validation/reference/ChannelCombine.cpp7
-rw-r--r--tests/validation/reference/ConvertFullyConnectedWeights.cpp5
-rw-r--r--tests/validation/reference/Convolution.cpp6
-rw-r--r--tests/validation/reference/CropResize.cpp2
-rw-r--r--tests/validation/reference/DFT.cpp26
-rw-r--r--tests/validation/reference/Derivative.cpp5
-rw-r--r--tests/validation/reference/Dilate.cpp5
-rw-r--r--tests/validation/reference/Erode.cpp5
-rw-r--r--tests/validation/reference/FastCorners.cpp5
-rw-r--r--tests/validation/reference/Gaussian3x3.cpp8
-rw-r--r--tests/validation/reference/Gaussian5x5.cpp8
-rw-r--r--tests/validation/reference/HOGDescriptor.cpp8
-rw-r--r--tests/validation/reference/Median3x3.cpp5
-rw-r--r--tests/validation/reference/NonLinearFilter.cpp15
-rw-r--r--tests/validation/reference/NonMaximaSuppression.cpp5
-rw-r--r--tests/validation/reference/PadLayer.cpp3
-rw-r--r--tests/validation/reference/Permute.cpp3
-rw-r--r--tests/validation/reference/Remap.cpp9
-rw-r--r--tests/validation/reference/Reverse.cpp5
-rw-r--r--tests/validation/reference/Scale.cpp3
-rw-r--r--tests/validation/reference/Scharr.cpp5
-rw-r--r--tests/validation/reference/Sobel.cpp3
-rw-r--r--tests/validation/reference/Tile.cpp5
-rw-r--r--tests/validation/reference/Transpose.cpp5
-rw-r--r--tests/validation/reference/WarpAffine.cpp5
-rw-r--r--tests/validation/reference/WarpPerspective.cpp5
-rw-r--r--tests/validation/reference/YOLOLayer.cpp3
-rw-r--r--utils/ImageLoader.h1
-rw-r--r--utils/Utils.cpp1
-rw-r--r--utils/Utils.h1
41 files changed, 150 insertions, 109 deletions
diff --git a/SConstruct b/SConstruct
index 83eb7e03f3..8509fedbb3 100644
--- a/SConstruct
+++ b/SConstruct
@@ -132,8 +132,8 @@ if not env['exceptions']:
env.Append(CXXFLAGS = ['-Wall','-DARCH_ARM',
'-Wextra','-pedantic','-Wdisabled-optimization','-Wformat=2',
'-Winit-self','-Wstrict-overflow=2','-Wswitch-default',
- '-fpermissive','-std=gnu++11','-Wno-vla','-Woverloaded-virtual',
- '-Wctor-dtor-privacy','-Wsign-promo','-Weffc++','-Wno-overlength-strings','-Wno-strict-overflow'])
+ '-fpermissive','-std=gnu++11','-Woverloaded-virtual', '-Wformat-security',
+ '-Wctor-dtor-privacy','-Wsign-promo','-Weffc++','-Wno-overlength-strings'])
env.Append(CPPDEFINES = ['_GLIBCXX_USE_NANOSLEEP'])
diff --git a/src/core/NEON/kernels/NEScaleKernel.cpp b/src/core/NEON/kernels/NEScaleKernel.cpp
index a2a44fca18..80da54f50a 100644
--- a/src/core/NEON/kernels/NEScaleKernel.cpp
+++ b/src/core/NEON/kernels/NEScaleKernel.cpp
@@ -227,7 +227,7 @@ inline void scale_bilinear_nhwc_core(const ITensor *input, const ITensor *offset
border_value = static_cast<T>(constant_border_value.get<ConstType>());
}
- auto is_valid = [](int x, int low_x, int high_x, int y, int low_y, int high_y)
+ auto is_valid = [](int64_t x, int64_t low_x, int64_t high_x, int64_t y, int64_t low_y, int64_t high_y)
{
return !(x < low_x || x > high_x || y < low_y || y > high_y);
};
diff --git a/src/core/utils/helpers/tensor_transform.cpp b/src/core/utils/helpers/tensor_transform.cpp
index f6a54a59ee..cd874b24b3 100644
--- a/src/core/utils/helpers/tensor_transform.cpp
+++ b/src/core/utils/helpers/tensor_transform.cpp
@@ -88,7 +88,14 @@ int calculate_end_on_index(TensorShape input_shape, int index, int start_on_inde
// Shrink dimension
if(shrink_axis)
{
- stop = start_on_index + 1;
+ if(start_on_index == std::numeric_limits<int>::max())
+ {
+ stop = start_on_index;
+ }
+ else
+ {
+ stop = start_on_index + 1;
+ }
}
// Reset in case of begin mask present
diff --git a/src/runtime/CL/functions/CLCropResize.cpp b/src/runtime/CL/functions/CLCropResize.cpp
index b22809eb09..5e1278df5b 100644
--- a/src/runtime/CL/functions/CLCropResize.cpp
+++ b/src/runtime/CL/functions/CLCropResize.cpp
@@ -48,7 +48,7 @@ inline void configure_crop(const ICLTensor *input, ICLTensor *crop_boxes, ICLTen
std::floor(y0 * (input->info()->tensor_shape()[2] - 1) + 0.5f));
end = Coordinates(std::floor(x1 * (input->info()->tensor_shape()[1] - 1) + 0.5f),
std::floor(y1 * (input->info()->tensor_shape()[2] - 1) + 0.5f));
- const TensorShape out_shape(input->info()->tensor_shape()[0], abs(end[0] - start[0]) + 1, abs(end[1] - start[1]) + 1);
+ const TensorShape out_shape(input->info()->tensor_shape()[0], static_cast<uint32_t>(abs(end[0] - start[0])) + 1, static_cast<uint32_t>(abs(end[1] - start[1])) + 1);
output->info()->set_tensor_shape(out_shape);
}
diff --git a/tests/AssetsLibrary.h b/tests/AssetsLibrary.h
index a512dab36b..f535f16303 100644
--- a/tests/AssetsLibrary.h
+++ b/tests/AssetsLibrary.h
@@ -491,12 +491,12 @@ template <typename T, typename D>
void AssetsLibrary::fill_boxes(T &&tensor, D &&distribution, std::random_device::result_type seed_offset) const
{
using ResultType = typename std::remove_reference<D>::type::result_type;
- std::mt19937 gen(_seed + seed_offset);
- TensorShape shape(tensor.shape());
- const int num_boxes = tensor.num_elements() / 4;
+ std::mt19937 gen(_seed + seed_offset);
+ TensorShape shape(tensor.shape());
+ const uint32_t num_boxes = tensor.num_elements() / 4;
// Iterate over all elements
std::uniform_real_distribution<> size_dist(0.f, 1.f);
- for(int element_idx = 0; element_idx < num_boxes * 4; element_idx += 4)
+ for(uint32_t element_idx = 0; element_idx < num_boxes * 4; element_idx += 4)
{
const ResultType delta = size_dist(gen);
const ResultType epsilon = size_dist(gen);
@@ -538,7 +538,8 @@ void AssetsLibrary::fill(T &&tensor, D &&distribution, std::random_device::resul
}
// Iterate over all elements
- for(int element_idx = 0; element_idx < tensor.num_elements(); ++element_idx)
+ const uint32_t num_elements = tensor.num_elements();
+ for(uint32_t element_idx = 0; element_idx < num_elements; ++element_idx)
{
Coordinates id = index2coord(shape, element_idx);
diff --git a/tests/Utils.h b/tests/Utils.h
index 3bb6060951..0c4aeb61f5 100644
--- a/tests/Utils.h
+++ b/tests/Utils.h
@@ -633,8 +633,8 @@ inline void init_separable_conv(int16_t *conv, unsigned int width, unsigned int
// 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];
+ int16_t *conv_row = new int16_t[width];
+ int16_t *conv_col = new int16_t[height];
conv_row[0] = conv_col[0] = 1;
for(unsigned int i = 1; i < width; ++i)
@@ -655,6 +655,9 @@ inline void init_separable_conv(int16_t *conv, unsigned int width, unsigned int
conv[i * width + j] = conv_col[i] * conv_row[j];
}
}
+
+ delete[] conv_row;
+ delete[] conv_col;
}
/** Create a vector with a uniform distribution of floating point values across the specified range.
diff --git a/tests/framework/instruments/MaliCounter.cpp b/tests/framework/instruments/MaliCounter.cpp
index f3ec45d485..354c899253 100644
--- a/tests/framework/instruments/MaliCounter.cpp
+++ b/tests/framework/instruments/MaliCounter.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -401,7 +401,7 @@ void MaliCounter::stop()
const int frag_index = find_counter_index_by_name(mali_userspace::MALI_NAME_BLOCK_SHADER, "FRAG_ACTIVE");
// Shader core counters can be averaged if desired, but here we don't.
- for(int core = 0; core < _num_cores; ++core)
+ for(uint32_t core = 0; core < _num_cores; ++core)
{
const uint32_t *sc_counter = get_counters(mali_userspace::MALI_NAME_BLOCK_SHADER, core);
diff --git a/tests/framework/instruments/MaliCounter.h b/tests/framework/instruments/MaliCounter.h
index a3cc446cb2..94ef93fdb5 100644
--- a/tests/framework/instruments/MaliCounter.h
+++ b/tests/framework/instruments/MaliCounter.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -86,7 +86,7 @@ private:
const char *const _device
{ "/dev/mali0"
};
- int _num_cores{ 0 };
+ uint32_t _num_cores{ 0 };
uint32_t _hw_ver{ 0 };
int _buffer_count{ 16 };
size_t _buffer_size{ 0 };
diff --git a/tests/validation/Validation.cpp b/tests/validation/Validation.cpp
index 0bc1d96306..89bbb2ef15 100644
--- a/tests/validation/Validation.cpp
+++ b/tests/validation/Validation.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -183,7 +183,8 @@ void validate(const IAccessor &tensor, const void *reference_value)
const size_t channel_size = element_size_from_data_type(tensor.data_type());
// Iterate over all elements, e.g. U8, S16, RGB888, ...
- for(int element_idx = 0; element_idx < tensor.num_elements(); ++element_idx)
+ const uint32_t tensor_num_elements = tensor.num_elements();
+ for(uint32_t element_idx = 0; element_idx < tensor_num_elements; ++element_idx)
{
const Coordinates id = index2coord(tensor.shape(), element_idx);
diff --git a/tests/validation/Validation.h b/tests/validation/Validation.h
index 1c4b2d4d11..6ef1a466e7 100644
--- a/tests/validation/Validation.h
+++ b/tests/validation/Validation.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -380,8 +380,8 @@ void validate_wrap(const IAccessor &tensor, const SimpleTensor<T> &reference, U
template <typename T, typename U>
void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const ValidRegion &valid_region, U tolerance_value, float tolerance_number, float absolute_tolerance_value)
{
- int64_t num_mismatches = 0;
- int64_t num_elements = 0;
+ uint64_t num_mismatches = 0;
+ uint64_t num_elements = 0;
ARM_COMPUTE_EXPECT_EQUAL(tensor.element_size(), reference.element_size(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT_EQUAL(tensor.data_type(), reference.data_type(), framework::LogLevel::ERRORS);
@@ -441,10 +441,10 @@ void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const V
}
}
- if(num_elements > 0)
+ if(num_elements != 0)
{
- const int64_t absolute_tolerance_number = tolerance_number * num_elements;
- const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f;
+ const uint64_t absolute_tolerance_number = tolerance_number * num_elements;
+ const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f;
ARM_COMPUTE_TEST_INFO(num_mismatches << " values (" << std::fixed << std::setprecision(2) << percent_mismatches
<< "%) mismatched (maximum tolerated " << std::setprecision(2) << tolerance_number * 100 << "%)");
@@ -455,8 +455,8 @@ void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const V
template <typename T, typename U, typename = typename std::enable_if<std::is_integral<T>::value>::type>
void validate_wrap(const IAccessor &tensor, const SimpleTensor<T> &reference, const ValidRegion &valid_region, U tolerance_value, float tolerance_number)
{
- int64_t num_mismatches = 0;
- int64_t num_elements = 0;
+ uint64_t num_mismatches = 0;
+ uint64_t num_elements = 0;
ARM_COMPUTE_EXPECT_EQUAL(tensor.element_size(), reference.element_size(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT_EQUAL(tensor.data_type(), reference.data_type(), framework::LogLevel::ERRORS);
@@ -529,10 +529,10 @@ void validate_wrap(const IAccessor &tensor, const SimpleTensor<T> &reference, co
}
}
- if(num_elements > 0)
+ if(num_elements != 0)
{
- const int64_t absolute_tolerance_number = tolerance_number * num_elements;
- const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f;
+ const uint64_t absolute_tolerance_number = tolerance_number * num_elements;
+ const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f;
ARM_COMPUTE_TEST_INFO(num_mismatches << " values (" << std::fixed << std::setprecision(2) << percent_mismatches
<< "%) mismatched (maximum tolerated " << std::setprecision(2) << tolerance_number * 100 << "%)");
@@ -543,8 +543,8 @@ void validate_wrap(const IAccessor &tensor, const SimpleTensor<T> &reference, co
template <typename T, typename U>
void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const SimpleTensor<T> &valid_mask, U tolerance_value, float tolerance_number, float absolute_tolerance_value)
{
- int64_t num_mismatches = 0;
- int64_t num_elements = 0;
+ uint64_t num_mismatches = 0;
+ uint64_t num_elements = 0;
ARM_COMPUTE_EXPECT_EQUAL(tensor.element_size(), reference.element_size(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT_EQUAL(tensor.data_type(), reference.data_type(), framework::LogLevel::ERRORS);
@@ -608,10 +608,10 @@ void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const S
}
}
- if(num_elements > 0)
+ if(num_elements != 0)
{
- const int64_t absolute_tolerance_number = tolerance_number * num_elements;
- const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f;
+ const uint64_t absolute_tolerance_number = tolerance_number * num_elements;
+ const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f;
ARM_COMPUTE_TEST_INFO(num_mismatches << " values (" << std::fixed << std::setprecision(2) << percent_mismatches
<< "%) mismatched (maximum tolerated " << std::setprecision(2) << tolerance_number * 100 << "%)");
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);
diff --git a/utils/ImageLoader.h b/utils/ImageLoader.h
index f37ffa2820..c03cbdf203 100644
--- a/utils/ImageLoader.h
+++ b/utils/ImageLoader.h
@@ -33,6 +33,7 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-default"
+#pragma GCC diagnostic ignored "-Wstrict-overflow"
#include "stb/stb_image.h"
#pragma GCC diagnostic pop
diff --git a/utils/Utils.cpp b/utils/Utils.cpp
index 20ccf55af8..80b47d7675 100644
--- a/utils/Utils.cpp
+++ b/utils/Utils.cpp
@@ -36,6 +36,7 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-default"
#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Wstrict-overflow"
#define STB_IMAGE_IMPLEMENTATION
#include "stb/stb_image.h"
#pragma GCC diagnostic pop
diff --git a/utils/Utils.h b/utils/Utils.h
index bc2fef4eb0..1d59ee5679 100644
--- a/utils/Utils.h
+++ b/utils/Utils.h
@@ -32,6 +32,7 @@
#include "arm_compute/runtime/Tensor.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Wstrict-overflow"
#include "libnpy/npy.hpp"
#pragma GCC diagnostic pop
#include "support/ToolchainSupport.h"