From 9859afa97939665de5cd02405bbed923f21655af Mon Sep 17 00:00:00 2001 From: wawltor Date: Wed, 30 Dec 2020 15:45:51 +0800 Subject: [PATCH] fix the state_dict bug for the xpu (#30008) --- python/paddle/fluid/dygraph/layers.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/paddle/fluid/dygraph/layers.py b/python/paddle/fluid/dygraph/layers.py index fd824de3a1e..edaed181663 100644 --- a/python/paddle/fluid/dygraph/layers.py +++ b/python/paddle/fluid/dygraph/layers.py @@ -1262,6 +1262,10 @@ class Layer(core.Layer): place = core.CPUPlace() elif p.is_cuda_pinned_place(): place = core.CUDAPinnedPlace() + elif p.is_xpu_place(): + p = core.Place() + p.set_place(t._place()) + place = core.XPUPlace(p.xpu_device_id()) else: p = core.Place() p.set_place(t._place()) -- GitLab