Skip to content

Commit

Permalink
Meshgrid indexing='ij' for PyTorch 1.10
Browse files Browse the repository at this point in the history
Will not merge currently as breaks backwards compatibility.
  • Loading branch information
glenn-jocher committed Oct 23, 2021
1 parent fee83c1 commit 9c77dcf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion models/yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def forward(self, x):

def _make_grid(self, nx=20, ny=20, i=0):
d = self.anchors[i].device
yv, xv = torch.meshgrid([torch.arange(ny).to(d), torch.arange(nx).to(d)])
yv, xv = torch.meshgrid([torch.arange(ny).to(d), torch.arange(nx).to(d)], indexing='ij')
grid = torch.stack((xv, yv), 2).expand((1, self.na, ny, nx, 2)).float()
anchor_grid = (self.anchors[i].clone() * self.stride[i]) \
.view((1, self.na, 1, 1, 2)).expand((1, self.na, ny, nx, 2)).float()
Expand Down

0 comments on commit 9c77dcf

Please sign in to comment.