From 8019fa9e547ccba9dd0183b33b2e081716d6e545 Mon Sep 17 00:00:00 2001 From: wangxinxin08 <69842442+wangxinxin08@users.noreply.github.com> Date: Fri, 23 Jul 2021 11:17:52 +0800 Subject: [PATCH] fix expand problem again (#3752) --- ppdet/modeling/necks/yolo_fpn.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ppdet/modeling/necks/yolo_fpn.py b/ppdet/modeling/necks/yolo_fpn.py index 041ccd2dc..e829a379f 100644 --- a/ppdet/modeling/necks/yolo_fpn.py +++ b/ppdet/modeling/necks/yolo_fpn.py @@ -24,10 +24,11 @@ __all__ = ['YOLOv3FPN', 'PPYOLOFPN', 'PPYOLOTinyFPN', 'PPYOLOPAN'] def add_coord(x, data_format): + shape = paddle.shape(x) if data_format == 'NCHW': - b, _, h, w = paddle.shape(x) + b, h, w = shape[0], shape[2], shape[3] else: - b, h, w, _ = paddle.shape(x) + b, h, w = shape[0], shape[1], shape[2] gx = paddle.arange(w, dtype=x.dtype) / ((w - 1.) * 2.0) - 1. gy = paddle.arange(h, dtype=x.dtype) / ((h - 1.) * 2.0) - 1. -- GitLab