From 9c77dcf2889de93264ba0f96b19178e143fd0e1a Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 23 Oct 2021 14:29:54 +0200 Subject: [PATCH] Meshgrid `indexing='ij'` for PyTorch 1.10 Will not merge currently as breaks backwards compatibility. --- models/yolo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/yolo.py b/models/yolo.py index 497a0e9c24e6..bb493b652ac8 100644 --- a/models/yolo.py +++ b/models/yolo.py @@ -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()