From b89ecf9b374bee8973c331bb44b99611152cd3ac Mon Sep 17 00:00:00 2001 From: Mehmet Fatih OZDEMIR Date: Fri, 18 Mar 2022 10:50:02 +0300 Subject: [PATCH] Fixed "Error in checking torchvision.__version__ with double digits in util/misc.py" --- util/misc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/misc.py b/util/misc.py index 8a67c26..98012a3 100644 --- a/util/misc.py +++ b/util/misc.py @@ -22,7 +22,7 @@ # needed due to empty tensor bug in pytorch and torchvision 0.5 import torchvision -if float(torchvision.__version__[:3]) < 0.7: +if float(torchvision.__version__.split('.')[1]) < 7: from torchvision.ops import _new_empty_tensor from torchvision.ops.misc import _output_size @@ -447,7 +447,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 float(torchvision.__version__.split('.')[1]) < 7: if input.numel() > 0: return torch.nn.functional.interpolate( input, size, scale_factor, mode, align_corners