Skip to content

Commit

Permalink
fix shape to avoid trt problem (#3963)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxinxin08 authored Aug 13, 2021
1 parent a0da6e5 commit b30bd30
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ppdet/modeling/necks/yolo_fpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@


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.
Expand Down

0 comments on commit b30bd30

Please sign in to comment.