From f6e791cbb2273999082547c3cbdb9f9eb39fa266 Mon Sep 17 00:00:00 2001 From: Anurag Arnab Date: Sun, 4 Sep 2022 21:42:34 +0200 Subject: [PATCH] The current check fails for torchvision versions >= 0.10. This commit corrects the parsing of the version number. --- state-change-object-detection-baselines/DETR/util/misc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/state-change-object-detection-baselines/DETR/util/misc.py b/state-change-object-detection-baselines/DETR/util/misc.py index 1d4e5eb..e6ac712 100644 --- a/state-change-object-detection-baselines/DETR/util/misc.py +++ b/state-change-object-detection-baselines/DETR/util/misc.py @@ -18,7 +18,7 @@ # needed due to empty tensor bug in pytorch and torchvision 0.5 import torchvision -if float(torchvision.__version__[:3]) < 0.7: +if int(torchvision.__version__.split('.')[1]) < 7: from torchvision.ops import _new_empty_tensor from torchvision.ops.misc import _output_size @@ -454,7 +454,7 @@ def interpolate(input, size=None, scale_factor=None, mode="nearest", align_corne This will eventually be supported natively by PyTorch, and this class can go away. """ - if float(torchvision.__version__[:3]) < 0.7: + if int(torchvision.__version__.split('.')[1]) < 7: if input.numel() > 0: return torch.nn.functional.interpolate( input, size, scale_factor, mode, align_corners