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

fix expand problem again (#3753)

上级 4ee74daf
...@@ -24,10 +24,11 @@ __all__ = ['YOLOv3FPN', 'PPYOLOFPN', 'PPYOLOTinyFPN', 'PPYOLOPAN'] ...@@ -24,10 +24,11 @@ __all__ = ['YOLOv3FPN', 'PPYOLOFPN', 'PPYOLOTinyFPN', 'PPYOLOPAN']
def add_coord(x, data_format): def add_coord(x, data_format):
shape = paddle.shape(x)
if data_format == 'NCHW': if data_format == 'NCHW':
b, _, h, w = paddle.shape(x) b, h, w = shape[0], shape[2], shape[3]
else: 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. 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.
先完成此消息的编辑!
想要评论请 注册