From cf8d74142e8c4c394b6bee23c31e70d26bd12f9d Mon Sep 17 00:00:00 2001 From: Xinglin Qiang Date: Wed, 18 Dec 2024 14:27:52 +0800 Subject: [PATCH] Add torch.cuda.synchronize() to avoid some machines may return all 0 tensors to cpu --- lightglue/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lightglue/utils.py b/lightglue/utils.py index d1c1ab2..5f30720 100644 --- a/lightglue/utils.py +++ b/lightglue/utils.py @@ -162,4 +162,5 @@ def match_pair( data = [feats0, feats1, matches01] # remove batch dim and move to target device feats0, feats1, matches01 = [batch_to_device(rbd(x), device) for x in data] + torch.cuda.synchronize() return feats0, feats1, matches01