Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

Fix mypy issue with torch.linalg (#1236)

Edgar Riba737c2a519b2a
diff --git a/kornia/utils/_compat.py b/kornia/utils/_compat.py
index 1481eeb2e..edc219989 100644
--- a/kornia/utils/_compat.py
+++ b/kornia/utils/_compat.py
@@ -3,7 +3,10 @@ import torch
from packaging import version
if version.parse(torch.__version__) > version.parse("1.7.1"):
- from torch.linalg import solve
+ # 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.1
+ from torch.linalg import solve # type: ignore
else:
from torch import solve as _solve