未验证 提交 6abad160 编写于 作者: W wangxinxin08 提交者: GitHub

fix shape to avoid trt problem (#3962)

上级 abfa9e3c
...@@ -24,11 +24,11 @@ __all__ = ['YOLOv3FPN', 'PPYOLOFPN', 'PPYOLOTinyFPN', 'PPYOLOPAN'] ...@@ -24,11 +24,11 @@ __all__ = ['YOLOv3FPN', 'PPYOLOFPN', 'PPYOLOTinyFPN', 'PPYOLOPAN']
def add_coord(x, data_format): def add_coord(x, data_format):
shape = paddle.shape(x) b = paddle.shape(x)[0]
if data_format == 'NCHW': if data_format == 'NCHW':
b, h, w = shape[0], shape[2], shape[3] h, w = x.shape[2], x.shape[3]
else: 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. gx = paddle.arange(w, dtype=x.dtype) / ((w - 1.) * 2.0) - 1.
gy = paddle.arange(h, dtype=x.dtype) / ((h - 1.) * 2.0) - 1. gy = paddle.arange(h, dtype=x.dtype) / ((h - 1.) * 2.0) - 1.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册