Commit b2d1dbcf authored by Jinku Cui's avatar Jinku Cui
Browse files

Replace the numpy.meshgrid() with more efficient torch.meshgrid()

1 merge request!111Replace the numpy.meshgrid() with more efficient torch.meshgrid()
Pipeline #1417 failed with stages
Showing with 2 additions and 3 deletions
+2 -3
......@@ -244,11 +244,10 @@ class backWarp(nn.Module):
super(backWarp, self).__init__()
# create a grid
gridX, gridY = np.meshgrid(np.arange(W), np.arange(H))
self.W = W
self.H = H
self.gridX = torch.tensor(gridX, requires_grad=False, device=device)
self.gridY = torch.tensor(gridY, requires_grad=False, device=device)
self.gridX, self.gridY = torch.meshgrid(torch.arange(W, requires_grad=False, device=device),
torch.arange(H, requires_grad=False, device=device), indexing='xy')
def forward(self, img, flow):
"""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment