未验证 提交 1ed5ae7a 编写于 作者: Y Yi Wang 提交者: GitHub

Fix comparing between signed and unsigned values (#5328)

上级 1796a2ab
...@@ -83,7 +83,7 @@ void Executor::Run(const ProgramDescBind& pdesc, Scope* scope, int block_id, ...@@ -83,7 +83,7 @@ void Executor::Run(const ProgramDescBind& pdesc, Scope* scope, int block_id,
// TODO(tonyyang-svail): // TODO(tonyyang-svail):
// - only runs on the first device (i.e. no interdevice communication) // - only runs on the first device (i.e. no interdevice communication)
// - will change to use multiple blocks for RNN op and Cond Op // - will change to use multiple blocks for RNN op and Cond Op
PADDLE_ENFORCE_LT(block_id, pdesc.Size()); PADDLE_ENFORCE_LT(static_cast<size_t>(block_id), pdesc.Size());
auto& block = pdesc.Block(block_id); auto& block = pdesc.Block(block_id);
auto& device = device_contexts_[0]; auto& device = device_contexts_[0];
......
...@@ -407,7 +407,7 @@ real AucEvaluator::evalImp(std::vector<Argument>& arguments) { ...@@ -407,7 +407,7 @@ real AucEvaluator::evalImp(std::vector<Argument>& arguments) {
// Copy label from value to a vector. // Copy label from value to a vector.
if (nullptr == label && nullptr != labelval) { if (nullptr == label && nullptr != labelval) {
// label width is 1 // label width is 1
CHECK_EQ(1, labelval->getWidth()); CHECK_EQ(1U, labelval->getWidth());
VectorPtr vec = VectorPtr vec =
Vector::create(labelval->getData(), insNum, output->useGpu()); Vector::create(labelval->getData(), insNum, output->useGpu());
label = vec->castToInt(); label = vec->castToInt();
......
...@@ -32,7 +32,8 @@ class SeqExpandKernel : public framework::OpKernel<T> { ...@@ -32,7 +32,8 @@ class SeqExpandKernel : public framework::OpKernel<T> {
const T* x_data = x->data<T>(); const T* x_data = x->data<T>();
auto x_dims = x->dims(); auto x_dims = x->dims();
auto* y = context.Input<LoDTensor>("Y"); auto* y = context.Input<LoDTensor>("Y");
PADDLE_ENFORCE_EQ(x_dims[0], y->lod().back().size() - 1, PADDLE_ENFORCE_EQ(static_cast<size_t>(x_dims[0]),
y->lod().back().size() - 1,
"The size of last lod level in Input(Y)" "The size of last lod level in Input(Y)"
"must be equal to dims[0] of Input(X)."); "must be equal to dims[0] of Input(X).");
out->set_lod(y->lod()); out->set_lod(y->lod());
......
...@@ -85,7 +85,7 @@ public: ...@@ -85,7 +85,7 @@ public:
for (size_t i = 0; i < opts_.size(); ++i) { for (size_t i = 0; i < opts_.size(); ++i) {
int s = 0; int s = 0;
float* newp = (float*)opts_[i]->get_weight(&s); float* newp = (float*)opts_[i]->get_weight(&s);
EXPECT_EQ(s, kSize); EXPECT_EQ(static_cast<size_t>(s), kSize);
for (size_t j = 0; j < kSize; ++j) { for (size_t j = 0; j < kSize; ++j) {
EXPECT_EQ(newp[j], (*p)[j]); EXPECT_EQ(newp[j], (*p)[j]);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册