未验证 提交 0156669e 编写于 作者: C Chen Weihang 提交者: GitHub

open pten tensor test (#37673)

上级 a0631364
...@@ -37,7 +37,7 @@ void TestCopyTensor() { ...@@ -37,7 +37,7 @@ void TestCopyTensor() {
auto t1_cpu_cp = t1.template copy_to<T>(paddle::PlaceType::kCPU); auto t1_cpu_cp = t1.template copy_to<T>(paddle::PlaceType::kCPU);
CHECK((paddle::PlaceType::kCPU == t1_cpu_cp.place())); CHECK((paddle::PlaceType::kCPU == t1_cpu_cp.place()));
for (int64_t i = 0; i < t1.size(); i++) { for (int64_t i = 0; i < t1.size(); i++) {
CHECK_EQ(t1_cpu_cp.template data<T>()[i], T(5)); CHECK_EQ(t1_cpu_cp.template mutable_data<T>()[i], T(5));
} }
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) #if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
VLOG(2) << "Do GPU copy test"; VLOG(2) << "Do GPU copy test";
...@@ -49,7 +49,7 @@ void TestCopyTensor() { ...@@ -49,7 +49,7 @@ void TestCopyTensor() {
t1_gpu_cp_cp.template copy_to<T>(paddle::PlaceType::kCPU); t1_gpu_cp_cp.template copy_to<T>(paddle::PlaceType::kCPU);
CHECK((paddle::PlaceType::kCPU == t1_gpu_cp_cp_cpu.place())); CHECK((paddle::PlaceType::kCPU == t1_gpu_cp_cp_cpu.place()));
for (int64_t i = 0; i < t1.size(); i++) { for (int64_t i = 0; i < t1.size(); i++) {
CHECK_EQ(t1_gpu_cp_cp_cpu.template data<T>()[i], T(5)); CHECK_EQ(t1_gpu_cp_cp_cpu.template mutable_data<T>()[i], T(5));
} }
#endif #endif
} }
...@@ -206,19 +206,18 @@ void TestInitilized() { ...@@ -206,19 +206,18 @@ void TestInitilized() {
} }
TEST(PtenTensor, All) { TEST(PtenTensor, All) {
// TODO(chenweihang, before 2021.11.20) support copy, slice and cast methods VLOG(2) << "TestCopy";
// VLOG(2) << "TestCopy"; GroupTestCopy();
// GroupTestCopy();
VLOG(2) << "TestDtype"; VLOG(2) << "TestDtype";
GroupTestDtype(); GroupTestDtype();
VLOG(2) << "TestShape"; VLOG(2) << "TestShape";
TestAPISizeAndShape(); TestAPISizeAndShape();
VLOG(2) << "TestPlace"; VLOG(2) << "TestPlace";
TestAPIPlace(); TestAPIPlace();
// VLOG(2) << "TestSlice"; VLOG(2) << "TestSlice";
// TestAPISlice(); TestAPISlice();
// VLOG(2) << "TestCast"; VLOG(2) << "TestCast";
// GroupTestCast(); GroupTestCast();
VLOG(2) << "TestInitilized"; VLOG(2) << "TestInitilized";
TestInitilized(); TestInitilized();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册