🐍 Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
Fix type annotation for torch 1.13.0 (#2023)
João Gustavo A. Amorimbe6380eec2ec
diff --git a/kornia/utils/helpers.py b/kornia/utils/helpers.pyindex d7a44191e..1eaa3a4d0 100644--- a/kornia/utils/helpers.py+++ b/kornia/utils/helpers.py@@ -1,7 +1,7 @@import warningsfrom functools import partial, wrapsfrom inspect import isclass, isfunction-from typing import TYPE_CHECKING, Any, Callable, List, Optional, Tuple+from typing import TYPE_CHECKING, Any, Callable, List, Optional, Tuple, Union, overloadimport torch@@ -28,7 +28,17 @@ def get_cuda_device_if_available(index: int = 0) -> torch.device:return dev-def map_location_to_cpu(storage: str, *args: Any, **kwargs: Any) -> str:+@overload+def map_location_to_cpu(storage: Tensor, location: str) -> Tensor:+ ...+++@overload+def map_location_to_cpu(storage: str) -> str:+ ...+++def map_location_to_cpu(storage: Union[str, Tensor], *args: Any, **kwargs: Any) -> Union[str, Tensor]:return storage