Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

docs: added docstring to the detach tensor to gpu (#3131)

Varun Rao6866042e15d1
diff --git a/kornia/core/module.py b/kornia/core/module.py
index 4db837cce..88cd57077 100644
--- a/kornia/core/module.py
+++ b/kornia/core/module.py
@@ -191,6 +191,15 @@ class ImageModuleMixIn:
def _detach_tensor_to_cpu(
self, output_image: Union[Tensor, list[Tensor], tuple[Tensor]]
) -> Union[Tensor, list[Tensor], tuple[Tensor]]:
+ """Detach the input tensor (or list/tuple of tensors) from the GPU and move it to the CPU.
+
+ Args:
+ output_image (Union[Tensor, list[Tensor], tuple[Tensor]]): The input tensor(s) to be moved.
+
+ Returns:
+ Union[Tensor, list[Tensor], tuple[Tensor]]: The tensor(s) moved to the CPU and detached from
+ the computational graph.
+ """
if isinstance(output_image, (Tensor,)):
return output_image.detach().cpu()
if isinstance(