Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cleanup][A-7] Replace VarType #61548

Merged
merged 3 commits into from
Feb 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix
  • Loading branch information
enkilee committed Feb 4, 2024
commit 385b576fe82e765827ac7022004655a5c21b40ef
8 changes: 4 additions & 4 deletions test/legacy_test/test_var_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1483,11 +1483,11 @@ def func_setUp(self):

def func_test_to_api(self):
x_double = self.x._to(dtype='double')
self.assertEqual(x_double.dtype, paddle.base.paddle.float64)
self.assertEqual(x_double.dtype, paddle.float64)
np.testing.assert_allclose(self.np_x, x_double, rtol=1e-05)

x_ = self.x._to()
self.assertEqual(self.x.dtype, paddle.base.paddle.float64)
self.assertEqual(self.x.dtype, paddle.float64)
np.testing.assert_allclose(self.np_x, x_, rtol=1e-05)

if paddle.base.is_compiled_with_cuda():
Expand All @@ -1502,7 +1502,7 @@ def func_test_to_api(self):
x_gpu1 = self.x._to(device='gpu:0', dtype="float64")
self.assertTrue(x_gpu1.place.is_gpu_place())
self.assertEqual(x_gpu1.place.gpu_device_id(), 0)
self.assertEqual(x_gpu1.dtype, paddle.base.paddle.float64)
self.assertEqual(x_gpu1.dtype, paddle.float64)

x_gpu2 = self.x._to(device='gpu:0', dtype="float16")
self.assertTrue(x_gpu2.place.is_gpu_place())
Expand All @@ -1517,7 +1517,7 @@ def func_test_to_api(self):

x_cpu1 = self.x._to(device=paddle.CPUPlace(), dtype="float64")
self.assertTrue(x_cpu1.place.is_cpu_place())
self.assertEqual(x_cpu1.dtype, paddle.base.paddle.float64)
self.assertEqual(x_cpu1.dtype, paddle.float64)

x_cpu2 = self.x._to(device='cpu', dtype="float16")
self.assertTrue(x_cpu2.place.is_cpu_place())
Expand Down