From 6abad1604639ebcefdfdca139aa6b2dc8f2afe35 Mon Sep 17 00:00:00 2001 From: wangxinxin08 <69842442+wangxinxin08@users.noreply.github.com> Date: Fri, 13 Aug 2021 12:06:15 +0800 Subject: [PATCH] fix shape to avoid trt problem (#3962) --- ppdet/modeling/necks/yolo_fpn.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ppdet/modeling/necks/yolo_fpn.py b/ppdet/modeling/necks/yolo_fpn.py index e829a379f..bc9584874 100644 --- a/ppdet/modeling/necks/yolo_fpn.py +++ b/ppdet/modeling/necks/yolo_fpn.py @@ -24,11 +24,11 @@ __all__ = ['YOLOv3FPN', 'PPYOLOFPN', 'PPYOLOTinyFPN', 'PPYOLOPAN'] def add_coord(x, data_format): - shape = paddle.shape(x) + b = paddle.shape(x)[0] if data_format == 'NCHW': - b, h, w = shape[0], shape[2], shape[3] + h, w = x.shape[2], x.shape[3] else: - b, h, w = shape[0], shape[1], shape[2] + h, w = x.shape[1], x.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