Skip to content

Commit

Permalink
Merge pull request #104 from Skydes/fix-align-corners
Browse files Browse the repository at this point in the history
Bugfix for torch>=1.10
  • Loading branch information
romachalm committed Feb 15, 2022
2 parents 39327a2 + 8804490 commit 3e71a3b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion models/superpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def sample_descriptors(keypoints, descriptors, s: int = 8):
keypoints /= torch.tensor([(w*s - s/2 - 0.5), (h*s - s/2 - 0.5)],
).to(keypoints)[None]
keypoints = keypoints*2 - 1 # normalize to (-1, 1)
args = {'align_corners': True} if int(torch.__version__[2]) > 2 else {}
args = {'align_corners': True} if torch.__version__ >= '1.3' else {}
descriptors = torch.nn.functional.grid_sample(
descriptors, keypoints.view(b, 1, -1, 2), mode='bilinear', **args)
descriptors = torch.nn.functional.normalize(
Expand Down

0 comments on commit 3e71a3b

Please sign in to comment.