提交 74492d5d 编写于 作者: S Siddharth Goyal 提交者: Yi Wang

Add proper casts for avoiding warnings (#8346)

上级 e0fcaa51
...@@ -34,7 +34,7 @@ template <typename T> ...@@ -34,7 +34,7 @@ template <typename T>
void SetupTensor(paddle::framework::LoDTensor& input, void SetupTensor(paddle::framework::LoDTensor& input,
paddle::framework::DDim dims, paddle::framework::DDim dims,
std::vector<T>& data) { std::vector<T>& data) {
CHECK_EQ(paddle::framework::product(dims), data.size()); CHECK_EQ(paddle::framework::product(dims), static_cast<int64_t>(data.size()));
T* input_ptr = input.mutable_data<T>(dims, paddle::platform::CPUPlace()); T* input_ptr = input.mutable_data<T>(dims, paddle::platform::CPUPlace());
memcpy(input_ptr, data.data(), input.numel() * sizeof(T)); memcpy(input_ptr, data.data(), input.numel() * sizeof(T));
} }
...@@ -55,7 +55,7 @@ void SetupLoDTensor(paddle::framework::LoDTensor& input, ...@@ -55,7 +55,7 @@ void SetupLoDTensor(paddle::framework::LoDTensor& input,
paddle::framework::LoD lod, paddle::framework::LoD lod,
std::vector<T>& data) { std::vector<T>& data) {
const size_t level = lod.size() - 1; const size_t level = lod.size() - 1;
CHECK_EQ(dims[0], (lod[level]).back()); CHECK_EQ(dims[0], static_cast<int64_t>((lod[level]).back()));
input.set_lod(lod); input.set_lod(lod);
SetupTensor<T>(input, dims, data); SetupTensor<T>(input, dims, data);
} }
...@@ -84,7 +84,7 @@ void CheckError(paddle::framework::LoDTensor& output1, ...@@ -84,7 +84,7 @@ void CheckError(paddle::framework::LoDTensor& output1,
count++; count++;
} }
} }
EXPECT_EQ(count, 0) << "There are " << count << " different elements."; EXPECT_EQ(count, 0U) << "There are " << count << " different elements.";
} }
template <typename Place, bool IsCombined = false> template <typename Place, bool IsCombined = false>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册