Skip to content

Commit 445c74c

Browse files
authored
Merge pull request #8158 from qingqing01/nms_warning_fix
Fix warnings in multiclass_nms_op.cc.
2 parents 165450f + e9e2424 commit 445c74c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

paddle/operators/multiclass_nms_op.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static inline void GetMaxScoreIndex(
8585
std::stable_sort(sorted_indices->begin(), sorted_indices->end(),
8686
SortScorePairDescend<int>);
8787
// Keep top_k scores if needed.
88-
if (top_k > -1 && top_k < sorted_indices->size()) {
88+
if (top_k > -1 && top_k < static_cast<int>(sorted_indices->size())) {
8989
sorted_indices->resize(top_k);
9090
}
9191
}
@@ -151,7 +151,7 @@ class MultiClassNMSKernel : public framework::OpKernel<T> {
151151
while (sorted_indices.size() != 0) {
152152
const int idx = sorted_indices.front().second;
153153
bool keep = true;
154-
for (int k = 0; k < selected_indices->size(); ++k) {
154+
for (size_t k = 0; k < selected_indices->size(); ++k) {
155155
if (keep) {
156156
const int kept_idx = (*selected_indices)[k];
157157
T overlap = JaccardOverlap<T>(bbox_data + idx * box_size,
@@ -201,7 +201,7 @@ class MultiClassNMSKernel : public framework::OpKernel<T> {
201201
int label = it.first;
202202
const T* sdata = scores_data + label * predict_dim;
203203
const std::vector<int>& label_indices = it.second;
204-
for (int j = 0; j < label_indices.size(); ++j) {
204+
for (size_t j = 0; j < label_indices.size(); ++j) {
205205
int idx = label_indices[j];
206206
PADDLE_ENFORCE_LT(idx, predict_dim);
207207
score_index_pairs.push_back(
@@ -215,7 +215,7 @@ class MultiClassNMSKernel : public framework::OpKernel<T> {
215215

216216
// Store the new indices.
217217
std::map<int, std::vector<int>> new_indices;
218-
for (int j = 0; j < score_index_pairs.size(); ++j) {
218+
for (size_t j = 0; j < score_index_pairs.size(); ++j) {
219219
int label = score_index_pairs[j].second.first;
220220
int idx = score_index_pairs[j].second.second;
221221
new_indices[label].push_back(idx);
@@ -238,7 +238,7 @@ class MultiClassNMSKernel : public framework::OpKernel<T> {
238238
int label = it.first;
239239
const T* sdata = scores_data + label * predict_dim;
240240
const std::vector<int>& indices = it.second;
241-
for (int j = 0; j < indices.size(); ++j) {
241+
for (size_t j = 0; j < indices.size(); ++j) {
242242
int idx = indices[j];
243243
const T* bdata = bboxes_data + idx * kBBoxSize;
244244
odata[count * kOutputDim] = label; // label

0 commit comments

Comments
 (0)