Skip to content

Commit

Permalink
fix export problem
Browse files Browse the repository at this point in the history
  • Loading branch information
ziqi-jin committed Jul 27, 2022
1 parent a119d23 commit a7952c9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion models/yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ def forward(self, x):
x[i] = x[i].view(bs, self.na, self.no, ny, nx).permute(0, 1, 3, 4, 2).contiguous()

if not self.training: # inference
if self.grid[i].shape[2:4] != x[i].shape[2:4]:
if torch.onnx.is_in_onnx_export():
self.grid[i] = self._make_grid(nx, ny).to(x[i].device)
elif self.grid[i].shape[2:4] != x[i].shape[2:4]:
self.grid[i] = self._make_grid(nx, ny).to(x[i].device)
logits = x[i][..., 5:]

Expand Down

0 comments on commit a7952c9

Please sign in to comment.