glenn-jocher commited on
Commit
a233608
1 Parent(s): ba9ab66
Files changed (1) hide show
  1. models/yolo.py +1 -1
models/yolo.py CHANGED
@@ -27,7 +27,7 @@ class Detect(nn.Module):
27
  x[i] = x[i].view(bs, self.na, self.no, ny, nx).permute(0, 1, 3, 4, 2).contiguous()
28
 
29
  if not self.training: # inference
30
- if self.grid[i].shape[2:4] != x[i].shape[2:4]:
31
  self.grid[i] = self._make_grid(nx, ny).to(x[i].device)
32
 
33
  y = x[i].sigmoid()
 
27
  x[i] = x[i].view(bs, self.na, self.no, ny, nx).permute(0, 1, 3, 4, 2).contiguous()
28
 
29
  if not self.training: # inference
30
+ if (self.grid[i].shape[2:4] != x[i].shape[2:4]) | (self.grid[i].device != x[i].device):
31
  self.grid[i] = self._make_grid(nx, ny).to(x[i].device)
32
 
33
  y = x[i].sigmoid()