未验证 提交 23d2b079 编写于 作者: R ronnywang 提交者: GitHub

[CustomDevice] fix Tensor._to (#45337)

上级 55393172
...@@ -429,12 +429,14 @@ def monkey_patch_varbase(): ...@@ -429,12 +429,14 @@ def monkey_patch_varbase():
if device is not None: if device is not None:
if isinstance(device, str): if isinstance(device, str):
device = paddle.device._convert_to_place(device) device = paddle.device._convert_to_place(device)
elif isinstance(device, (core.CPUPlace, core.CUDAPlace, elif isinstance(
core.CUDAPinnedPlace, core.XPUPlace)): device,
(core.CPUPlace, core.CUDAPlace, core.CUDAPinnedPlace,
core.XPUPlace, core.CustomPlace)):
pass pass
else: else:
raise ValueError( raise ValueError(
"device value error, must be str, paddle.CPUPlace(), paddle.CUDAPlace(), paddle.CUDAPinnedPlace() or paddle.XPUPlace(), but the type of device is " "device value error, must be str, paddle.CPUPlace(), paddle.CUDAPlace(), paddle.CUDAPinnedPlace(), paddle.XPUPlace() or paddle.CustomPlace(), but the type of device is "
+ type(device).__name__) + type(device).__name__)
if blocking is None: if blocking is None:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册