We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 69ef801 commit de057cdCopy full SHA for de057cd
test/legacy_test/test_place_guard.py
@@ -131,6 +131,15 @@ def test_str_place_obj_nested(self):
131
self.assertEqual(x.place, place_obj1)
132
self.assertNotEqual(x.place, place_obj2)
133
134
+ def test_place_str_cuda(self):
135
+ if (
136
+ paddle.device.is_compiled_with_cuda()
137
+ and not paddle.device.is_compiled_with_rocm()
138
+ ):
139
+ with paddle.device.device_guard("gpu"):
140
+ tensor_cuda = paddle.randn([3, 3], device="cuda:0")
141
+ self.assertEqual(tensor_cuda.place, paddle.CUDAPlace(0))
142
+
143
144
if __name__ == "__main__":
145
unittest.main()
0 commit comments