From c53d21420543c1ab578db30f1dd74c0ded221cdd Mon Sep 17 00:00:00 2001 From: Luo Tao Date: Wed, 27 Sep 2017 19:44:37 +0800 Subject: [PATCH] fix compiler warning from MKLDNNLayer and so on --- paddle/framework/lod_tensor_test.cu | 4 ++-- paddle/gserver/layers/MKLDNNConvLayer.cpp | 2 +- paddle/gserver/layers/MKLDNNFcLayer.cpp | 2 +- paddle/gserver/tests/test_CrossEntropyOverBeamGrad.cpp | 2 +- paddle/operators/multiplex_op.cu | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/paddle/framework/lod_tensor_test.cu b/paddle/framework/lod_tensor_test.cu index 97e69cdb2e5..647d07536dd 100644 --- a/paddle/framework/lod_tensor_test.cu +++ b/paddle/framework/lod_tensor_test.cu @@ -36,8 +36,8 @@ TEST(LoDTensor, LoDInGPU) { lod_tensor.mutable_data(place); lod_tensor.set_lod(src_lod); - CHECK_EQ(lod_tensor.lod_element(0, 2), 4); - CHECK_EQ(lod_tensor.lod_element(0, 4), 8); + CHECK_EQ(lod_tensor.lod_element(0, 2), 4UL); + CHECK_EQ(lod_tensor.lod_element(0, 4), 8UL); auto lod = lod_tensor.lod(); diff --git a/paddle/gserver/layers/MKLDNNConvLayer.cpp b/paddle/gserver/layers/MKLDNNConvLayer.cpp index 9a0abd291ae..0d6742e9096 100644 --- a/paddle/gserver/layers/MKLDNNConvLayer.cpp +++ b/paddle/gserver/layers/MKLDNNConvLayer.cpp @@ -28,7 +28,7 @@ bool MKLDNNConvLayer::init(const LayerMap& layerMap, if (!MKLDNNLayer::init(layerMap, parameterMap)) { return false; } - CHECK_EQ(inputLayers_.size(), 1) << "Only support one input layer yet"; + CHECK_EQ(inputLayers_.size(), 1UL) << "Only support one input layer yet"; CHECK_EQ(inputLayers_.size(), parameters_.size()); CHECK(config_.shared_biases()) << "Only support shared biases yet"; diff --git a/paddle/gserver/layers/MKLDNNFcLayer.cpp b/paddle/gserver/layers/MKLDNNFcLayer.cpp index 8cbfbd0d2b9..e829456d6af 100644 --- a/paddle/gserver/layers/MKLDNNFcLayer.cpp +++ b/paddle/gserver/layers/MKLDNNFcLayer.cpp @@ -28,7 +28,7 @@ bool MKLDNNFcLayer::init(const LayerMap& layerMap, return false; } - CHECK_EQ(inputLayers_.size(), 1) << "Only support one input layer yet"; + CHECK_EQ(inputLayers_.size(), 1UL) << "Only support one input layer yet"; CHECK_EQ(inputLayers_.size(), parameters_.size()); CHECK(!parameters_[0]->isSparse()) << "Do not support sparse yet"; diff --git a/paddle/gserver/tests/test_CrossEntropyOverBeamGrad.cpp b/paddle/gserver/tests/test_CrossEntropyOverBeamGrad.cpp index 538d18cdc3d..c922237d33d 100644 --- a/paddle/gserver/tests/test_CrossEntropyOverBeamGrad.cpp +++ b/paddle/gserver/tests/test_CrossEntropyOverBeamGrad.cpp @@ -228,7 +228,7 @@ void genGroundTruth(vector& beamExpansions, curBeam.groundTruth[j] = *(start + n); curBeam.inBeam[j] = 1; } else { - CHECK_LE(curBeam.rowIdxInBeam[j] + 1, + CHECK_LE((size_t)curBeam.rowIdxInBeam[j] + 1, curBeam.subSeqStartPos.size() - 1); int start = curBeam.subSeqStartPos[curBeam.rowIdxInBeam[j]]; int end = curBeam.subSeqStartPos[curBeam.rowIdxInBeam[j] + 1]; diff --git a/paddle/operators/multiplex_op.cu b/paddle/operators/multiplex_op.cu index 70e46815fc9..505776612e7 100644 --- a/paddle/operators/multiplex_op.cu +++ b/paddle/operators/multiplex_op.cu @@ -42,7 +42,7 @@ class MultiplexGPUKernel : public framework::OpKernel { for (auto i = 0; i < rows; i++) { int32_t k = index[i]; PADDLE_ENFORCE_GE(k, 0, "index must be nonnegative."); - PADDLE_ENFORCE_LT(k, ins.size(), + PADDLE_ENFORCE_LT((size_t)k, ins.size(), "index exceeds the number of candidate tensors."); memory::Copy(place, out->data() + i * cols, place, ins[k]->data() + i * cols, cols * sizeof(T), stream); -- GitLab