From e49827047e1aee55530edc59554c88965f6c77fa Mon Sep 17 00:00:00 2001 From: wangguanzhong Date: Wed, 1 Sep 2021 12:25:58 +0800 Subject: [PATCH] refine set_device (#4102) --- ppdet/modeling/proposal_generator/target.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ppdet/modeling/proposal_generator/target.py b/ppdet/modeling/proposal_generator/target.py index c4aa00502..e7f3d90d2 100644 --- a/ppdet/modeling/proposal_generator/target.py +++ b/ppdet/modeling/proposal_generator/target.py @@ -74,8 +74,9 @@ def label_box(anchors, is_crowd=None, assign_on_cpu=False): if assign_on_cpu: - with paddle.fluid.framework._dygraph_place_guard(paddle.CPUPlace()): - iou = bbox_overlaps(gt_boxes, anchors) + paddle.set_device("cpu") + iou = bbox_overlaps(gt_boxes, anchors) + paddle.set_device("gpu") else: iou = bbox_overlaps(gt_boxes, anchors) n_gt = gt_boxes.shape[0] -- GitLab