diff --git a/ppdet/modeling/anchor_heads/retina_head.py b/ppdet/modeling/anchor_heads/retina_head.py index cb6cb1cfbc22c7bd7957961ce609fd80e6efd4d1..eed81eb4de2e2fdb480b5e73f06c88c433ac8e3d 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}