Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

fixed docstring issue (#3238)

Siddf4dcd02de8a1
diff --git a/kornia/contrib/models/rt_detr/post_processor.py b/kornia/contrib/models/rt_detr/post_processor.py
index 629373a4c..e57323885 100644
--- a/kornia/contrib/models/rt_detr/post_processor.py
+++ b/kornia/contrib/models/rt_detr/post_processor.py
@@ -28,26 +28,26 @@ from kornia.models.detection.utils import BoxFiltering
def mod(a: Tensor, b: int) -> Tensor:
- """Compute the modulo operation for two numbers.
+ """Compute the element-wise remainder of tensor `a` divided by integer `b`.
- This function calculates the remainder of the division of 'a' by 'b'
- using the formula: a - (a // b) * b, which is equivalent to the modulo operation.
+ This function requires `a` to be a `torch.Tensor` and `b` to be an `int`.
+ It returns a `torch.Tensor` with the same shape/device as `a`. The
+ implementation uses `a % b` (equivalent to `torch.remainder(a, b)`).
Args:
- a: The dividend.
- b: The divisor.
+ a (torch.Tensor): Dividend tensor (any numeric dtype).
+ b (int): Divisor (must be non-zero).
Returns:
- The remainder of a divided by b.
-
- Example:
- >>> mod(7, 3)
- 1
+ torch.Tensor: Element-wise remainder of `a` divided by `b`.
+ Examples:
+ >>> mod(torch.tensor(7), 3)
+ tensor(1)
+ >>> mod(torch.tensor([7, -1, 2]), 3)
+ tensor([1, 2, 2])
"""
- if not a.dtype.is_floating_point and a.dtype != torch.long:
- a = a.to(torch.long)
- return torch.remainder(a, b)
+ return a % b
# TODO: deprecate the confidence threshold and add the num_top_queries as a parameter and num_classes as a parameter