From 0156669e725ed9a5c76a30672b8cab157956058a Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Mon, 29 Nov 2021 20:33:04 -0600 Subject: [PATCH] open pten tensor test (#37673) --- paddle/pten/tests/api/test_pten_tensor.cc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/paddle/pten/tests/api/test_pten_tensor.cc b/paddle/pten/tests/api/test_pten_tensor.cc index 8cdd769558..81d46fdb57 100644 --- a/paddle/pten/tests/api/test_pten_tensor.cc +++ b/paddle/pten/tests/api/test_pten_tensor.cc @@ -37,7 +37,7 @@ void TestCopyTensor() { auto t1_cpu_cp = t1.template copy_to(paddle::PlaceType::kCPU); CHECK((paddle::PlaceType::kCPU == t1_cpu_cp.place())); for (int64_t i = 0; i < t1.size(); i++) { - CHECK_EQ(t1_cpu_cp.template data()[i], T(5)); + CHECK_EQ(t1_cpu_cp.template mutable_data()[i], T(5)); } #if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) VLOG(2) << "Do GPU copy test"; @@ -49,7 +49,7 @@ void TestCopyTensor() { t1_gpu_cp_cp.template copy_to(paddle::PlaceType::kCPU); CHECK((paddle::PlaceType::kCPU == t1_gpu_cp_cp_cpu.place())); for (int64_t i = 0; i < t1.size(); i++) { - CHECK_EQ(t1_gpu_cp_cp_cpu.template data()[i], T(5)); + CHECK_EQ(t1_gpu_cp_cp_cpu.template mutable_data()[i], T(5)); } #endif } @@ -206,19 +206,18 @@ void TestInitilized() { } TEST(PtenTensor, All) { - // TODO(chenweihang, before 2021.11.20) support copy, slice and cast methods - // VLOG(2) << "TestCopy"; - // GroupTestCopy(); + VLOG(2) << "TestCopy"; + GroupTestCopy(); VLOG(2) << "TestDtype"; GroupTestDtype(); VLOG(2) << "TestShape"; TestAPISizeAndShape(); VLOG(2) << "TestPlace"; TestAPIPlace(); - // VLOG(2) << "TestSlice"; - // TestAPISlice(); - // VLOG(2) << "TestCast"; - // GroupTestCast(); + VLOG(2) << "TestSlice"; + TestAPISlice(); + VLOG(2) << "TestCast"; + GroupTestCast(); VLOG(2) << "TestInitilized"; TestInitilized(); } -- GitLab