未验证 提交 e4982704 编写于 作者: W wangguanzhong 提交者: GitHub

refine set_device (#4102)

上级 69e909b4
...@@ -74,8 +74,9 @@ def label_box(anchors, ...@@ -74,8 +74,9 @@ def label_box(anchors,
is_crowd=None, is_crowd=None,
assign_on_cpu=False): assign_on_cpu=False):
if assign_on_cpu: if assign_on_cpu:
with paddle.fluid.framework._dygraph_place_guard(paddle.CPUPlace()): paddle.set_device("cpu")
iou = bbox_overlaps(gt_boxes, anchors) iou = bbox_overlaps(gt_boxes, anchors)
paddle.set_device("gpu")
else: else:
iou = bbox_overlaps(gt_boxes, anchors) iou = bbox_overlaps(gt_boxes, anchors)
n_gt = gt_boxes.shape[0] n_gt = gt_boxes.shape[0]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册