From 9e388947b79b7f9e608243aa5b11be4bc9a49e73 Mon Sep 17 00:00:00 2001 From: ShenLiang <2282912238@qq.com> Date: Thu, 27 Aug 2020 13:46:01 +0800 Subject: [PATCH] fix the dtype of loss (#1292) --- ppdet/modeling/anchor_heads/retina_head.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ppdet/modeling/anchor_heads/retina_head.py b/ppdet/modeling/anchor_heads/retina_head.py index cb6cb1cfb..eed81eb4d 100644 --- a/ppdet/modeling/anchor_heads/retina_head.py +++ b/ppdet/modeling/anchor_heads/retina_head.py @@ -404,5 +404,5 @@ class RetinaHead(object): inside_weight=bbox_weight, outside_weight=bbox_weight) loss_bbox = fluid.layers.reduce_sum(loss_bbox, name='loss_bbox') - loss_bbox = loss_bbox / fg_num + loss_bbox = loss_bbox / fluid.layers.cast(fg_num, loss_bbox.dtype) return {'loss_cls': loss_cls, 'loss_bbox': loss_bbox} -- GitLab