fix sign-compare warnings in template backend (#15880)

* fix detection_output.hpp

* fix roi_align.hpp

* fix detection_output.hpp

* convolution_backprop_data.hpp

* convert_color_nv12.hpp

* fix detection_output.hpp

* fix detection_output.hpp

* remove no-sign

* fix code style

* fix roi_align.hpp

* fix roi_align.hpp

* fix detection_output.hpp

* fix C4267
This commit is contained in:
Haiqi Pan 2023-02-22 20:35:28 -08:00 committed by GitHub
parent 6f85ee7968
commit 6bd7def8c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 15 deletions

View File

@ -42,12 +42,12 @@ void color_convert_nv12(const T* arg_y,
size_t stride_y,
size_t stride_uv,
ov::op::util::ConvertColorNV12Base::ColorConversion color_format) {
for (int batch = 0; batch < batch_size; batch++) {
for (size_t batch = 0; batch < batch_size; batch++) {
T* out = out_ptr + batch * image_w * image_h * 3;
auto y_ptr = arg_y + batch * stride_y;
auto uv_ptr = arg_uv + batch * stride_uv;
for (int h = 0; h < image_h; h++) {
for (int w = 0; w < image_w; w++) {
for (size_t h = 0; h < image_h; h++) {
for (size_t w = 0; w < image_w; w++) {
auto y_index = h * image_w + w;
auto y_val = static_cast<float>(y_ptr[y_index]);
auto uv_index = (h / 2) * image_w + (w / 2) * 2;
@ -80,13 +80,13 @@ void color_convert_i420(const T* arg_y,
size_t stride_y,
size_t stride_uv,
ov::op::util::ConvertColorI420Base::ColorConversion color_format) {
for (int batch = 0; batch < batch_size; batch++) {
for (size_t batch = 0; batch < batch_size; batch++) {
T* out = out_ptr + batch * image_w * image_h * 3;
auto y_ptr = arg_y + batch * stride_y;
auto u_ptr = arg_u + batch * stride_uv;
auto v_ptr = arg_v + batch * stride_uv;
for (int h = 0; h < image_h; h++) {
for (int w = 0; w < image_w; w++) {
for (size_t h = 0; h < image_h; h++) {
for (size_t w = 0; w < image_w; w++) {
auto y_index = h * image_w + w;
auto y_val = static_cast<float>(y_ptr[y_index]);
auto uv_index = (h / 2) * (image_w / 2) + (w / 2);

View File

@ -46,15 +46,15 @@ void extend_with_zeros(const Strides& strides,
const auto offset_batch = batch * input_size * input_shape[1];
for (size_t channel = 0; channel < input_shape[1]; ++channel) {
const auto offset_channel = offset_batch + channel * input_size;
for (int i_z = 0; i_z < input_3d[0]; ++i_z) {
for (size_t i_z = 0; i_z < input_3d[0]; ++i_z) {
const auto offset_i_z = i_z * input_3d[2] * input_3d[1];
for (int i_y = 0; i_y < input_3d[1]; ++i_y) {
for (size_t i_y = 0; i_y < input_3d[1]; ++i_y) {
const auto offset_i_y = i_y * input_3d[2];
for (int i_x = 0; i_x < input_3d[2]; ++i_x) {
for (size_t i_x = 0; i_x < input_3d[2]; ++i_x) {
input_zeros.push_back(in[offset_channel + i_x + offset_i_y + offset_i_z]);
if (i_x < input_3d[2] - 1) {
for (int k = 0; k < strides_3d[2] - 1; k++) {
for (size_t k = 0; k < strides_3d[2] - 1; k++) {
input_zeros.push_back(0);
}
}

View File

@ -38,7 +38,7 @@ private:
size_t offset;
size_t numResults;
size_t outTotalSize;
size_t numClasses;
int numClasses;
void GetLocPredictions(const dataType* locData, std::vector<LabelBBox>& locations) {
locations.resize(numImages);
@ -445,7 +445,7 @@ public:
offset = _attrs.normalized ? 0 : 1;
numPriors = priorsShape[2] / priorSize;
priorsBatchSize = priorsShape[0];
numClasses = classPredShape[1] / numPriors;
numClasses = classPredShape[1] / static_cast<int>(numPriors);
numLocClasses = _attrs.share_location ? 1 : numClasses;
numResults = outShape[2];
outTotalSize = shape_size(outShape);

View File

@ -109,8 +109,8 @@ void roi_align(const T* feature_maps,
T sample_x = x1 + static_cast<T>(x_bin_ind) * bin_width +
sample_distance_x * (static_cast<T>(x_sample_ind) + static_cast<T>(0.5f));
if (sample_x < -1.0 || sample_x > feature_map_width || sample_y < -1.0 ||
sample_y > feature_map_height) {
if (sample_x < -1.0 || sample_x > static_cast<T>(feature_map_width) || sample_y < -1.0 ||
sample_y > static_cast<T>(feature_map_height)) {
// For this sample we save 4x point (0,0) with weight 0
pooling_points.insert(pooling_points.end(), 4, {0, 0});
pooling_weights.insert(pooling_weights.end(), 4, T{0});

View File

@ -28,7 +28,6 @@ add_library(openvino::interpreter_backend ALIAS interpreter_backend)
if(CMAKE_COMPILER_IS_GNUCXX)
ie_add_compiler_flags(-Wno-missing-declarations)
ie_add_compiler_flags(-Wno-sign-compare)
endif()
ie_faster_build(interpreter_backend UNITY)