Skip to content

Commit 9aa6bfc

Browse files
authored
fix yolov3 return value in dygraph mode. test=develop (#40185)
1 parent 2ce007c commit 9aa6bfc

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

python/paddle/fluid/tests/unittests/test_yolov3_loss_op.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ def test_dygraph(self):
305305
use_label_smooth=True,
306306
scale_x_y=1.)
307307
assert loss is not None
308+
assert loss.shape == [2]
308309
paddle.enable_static()
309310

310311

python/paddle/vision/ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def yolo_loss(x,
195195
"""
196196

197197
if in_dygraph_mode() and gt_score is None:
198-
loss = _C_ops.yolov3_loss(
198+
loss, _, _ = _C_ops.yolov3_loss(
199199
x, gt_box, gt_label, 'anchors', anchors, 'anchor_mask', anchor_mask,
200200
'class_num', class_num, 'ignore_thresh', ignore_thresh,
201201
'downsample_ratio', downsample_ratio, 'use_label_smooth',

0 commit comments

Comments
 (0)