Skip to content

Commit 9c77dcf

Browse files
authored
Meshgrid indexing='ij' for PyTorch 1.10
Will not merge currently as breaks backwards compatibility.
1 parent fee83c1 commit 9c77dcf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

models/yolo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def forward(self, x):
7474

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

0 commit comments

Comments
 (0)