Skip to content

Commit 1ed5ae7

Browse files
authored
Fix comparing between signed and unsigned values (#5328)
1 parent 1796a2a commit 1ed5ae7

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

paddle/framework/executor.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void Executor::Run(const ProgramDescBind& pdesc, Scope* scope, int block_id,
8383
// TODO(tonyyang-svail):
8484
// - only runs on the first device (i.e. no interdevice communication)
8585
// - will change to use multiple blocks for RNN op and Cond Op
86-
PADDLE_ENFORCE_LT(block_id, pdesc.Size());
86+
PADDLE_ENFORCE_LT(static_cast<size_t>(block_id), pdesc.Size());
8787
auto& block = pdesc.Block(block_id);
8888
auto& device = device_contexts_[0];
8989

paddle/gserver/evaluators/Evaluator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ real AucEvaluator::evalImp(std::vector<Argument>& arguments) {
407407
// Copy label from value to a vector.
408408
if (nullptr == label && nullptr != labelval) {
409409
// label width is 1
410-
CHECK_EQ(1, labelval->getWidth());
410+
CHECK_EQ(1U, labelval->getWidth());
411411
VectorPtr vec =
412412
Vector::create(labelval->getData(), insNum, output->useGpu());
413413
label = vec->castToInt();

paddle/operators/seq_expand_op.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ class SeqExpandKernel : public framework::OpKernel<T> {
3232
const T* x_data = x->data<T>();
3333
auto x_dims = x->dims();
3434
auto* y = context.Input<LoDTensor>("Y");
35-
PADDLE_ENFORCE_EQ(x_dims[0], y->lod().back().size() - 1,
35+
PADDLE_ENFORCE_EQ(static_cast<size_t>(x_dims[0]),
36+
y->lod().back().size() - 1,
3637
"The size of last lod level in Input(Y)"
3738
"must be equal to dims[0] of Input(X).");
3839
out->set_lod(y->lod());

paddle/optimizer/parameter_optimizer_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class OptimizerTest : public testing::Test {
8585
for (size_t i = 0; i < opts_.size(); ++i) {
8686
int s = 0;
8787
float* newp = (float*)opts_[i]->get_weight(&s);
88-
EXPECT_EQ(s, kSize);
88+
EXPECT_EQ(static_cast<size_t>(s), kSize);
8989
for (size_t j = 0; j < kSize; ++j) {
9090
EXPECT_EQ(newp[j], (*p)[j]);
9191
}

0 commit comments

Comments
 (0)