Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

add example for lamba module (#1373)

Edgar Riba52f58f797e65
diff --git a/kornia/contrib/lambda_module.py b/kornia/contrib/lambda_module.py
index cf3b36109..073ac531c 100644
--- a/kornia/contrib/lambda_module.py
+++ b/kornia/contrib/lambda_module.py
@@ -11,7 +11,14 @@ class Lambda(nn.Module):
func: Callable function.
Returns:
- A torch.Tensor which is the output of the user-defined lambda
+ The output of the user-defined lambda.
+
+ Example:
+ >>> import kornia
+ >>> x = torch.rand(1, 3, 5, 5)
+ >>> f = Lambda(lambda x: kornia.color.rgb_to_grayscale(x))
+ >>> f(x).shape
+ torch.Size([1, 1, 5, 5])
"""
def __init__(self, func: Callable) -> None: