From 1317022a0b73b53377ac5fa98bdb28b509e77ab4 Mon Sep 17 00:00:00 2001 From: ShenLiang <2282912238@qq.com> Date: Tue, 1 Sep 2020 10:18:58 +0800 Subject: [PATCH] fix the dtype of loss (#1317) --- 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