提交 35e61b3e 编写于 作者: Y Yi Wang

Merge branch 'develop' of https://github.com/paddlepaddle/paddle into move_to_fluid

...@@ -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>
......
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import paddle.v2.fluid as fluid
class TestCSPFramework(unittest.TestCase):
def daisy_chain(self):
n = 10000
leftmost = fluid.make_channel(dtype=int)
right = leftmost
left = leftmost
with fluid.While(steps=n):
right = fluid.make_channel(dtype=int)
with fluid.go():
fluid.send(left, 1 + fluid.recv(right))
left = right
with fluid.go():
fluid.send(right, 1)
fluid.Print(fluid.recv(leftmost))
if __name__ == '__main__':
unittest.main()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册