π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
fixes torch version parse and add temporal packaging dependency (#1284)
Edgar Riba6ea072d43882
diff --git a/kornia/utils/_compat.py b/kornia/utils/_compat.pyindex edc219989..3177536a7 100644--- a/kornia/utils/_compat.py+++ b/kornia/utils/_compat.py@@ -2,7 +2,13 @@ import torchfrom packaging import version-if version.parse(torch.__version__) > version.parse("1.7.1"):++def torch_version() -> str:+ """Parse the `torch.__version__` variable and removes +cu*/cpu."""+ return torch.__version__.split('+')[0]+++if version.parse(torch_version()) > version.parse("1.7.1"):# TODO: remove the type: ignore once Python 3.6 is deprecated.# It turns out that Pytorch has no attribute `torch.linalg` for# Python 3.6 / PyTorch 1.7.0, 1.7.1diff --git a/setup.py b/setup.pyindex 4e46ef7af..4704019eb 100644--- a/setup.py+++ b/setup.py@@ -112,7 +112,10 @@ class clean(distutils.command.clean.clean):subprocess.call(['rm -rf dist/ build/ kornia.egg*'], shell=True)-requirements = ['torch' + kornia_pt_dependencies[dep_version(version)]]+requirements = [+ 'torch' + kornia_pt_dependencies[dep_version(version)],+ 'packaging' # REMOVE once we deprecate pytorch > 1.7.1. See: issue #1264+]if __name__ == '__main__':