internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: kornia/kornia

Issue:
Use more pythonic expressions in rgb to hls
Make improvements in the `kornia/color/hls.py` module to use more pythonic expressions. Ex:
```diff
-    r = torch.select(im, -3, 0)
+   r = im[…, 0, :,:]
```


_Originally posted by @edgarriba in https://github.com/kornia/kornia/pull/2030#discussion_r1032065189_
      


Discussion:

Resolving patch:
diff --git a/kornia/color/hls.py b/kornia/color/hls.py
--- a/kornia/color/hls.py
+++ b/kornia/color/hls.py
@@ -7,7 +7,7 @@
 
 
 def rgb_to_hls(image: Tensor, eps: float = 1e-8) -> Tensor:
-    r"""Convert a RGB image to HLS.
+    r"""Convert an RGB image to HLS.
 
     .. image:: _static/img/rgb_to_hls.png
 
@@ -51,9 +51,7 @@ def rgb_to_hls(image: Tensor, eps: float = 1e-8) -> Tensor:
         # so, h, l and s require inplace operations
         # NOTE: stack() increases in a 10% the cost in colab
         image_hls = torch.empty_like(image)
-        h = torch.select(image_hls, -3, 0)
-        l_ = torch.select(image_hls, -3, 1)
-        s = torch.select(image_hls, -3, 2)
+        h, l_, s = image_hls[..., 0, :, :], image_hls[..., 1, :, :], image_hls[..., 2, :, :]
         torch.add(maxc, minc, out=l_)  # l = max + min
         torch.sub(maxc, minc, out=s)  # s = max - min
 
@@ -65,19 +63,18 @@ def rgb_to_hls(image: Tensor, eps: float = 1e-8) -> Tensor:
     l_ /= 2  # luminance
 
     # note that r,g and b were previously div by (max - min)
-    r = torch.select(im, -3, 0)
-    g = torch.select(im, -3, 1)
-    b = torch.select(im, -3, 2)
+    r, g, b = im[..., 0, :, :], im[..., 1, :, :], im[..., 2, :, :]
     # h[imax == 0] = (((g - b) / (max - min)) % 6)[imax == 0]
     # h[imax == 1] = (((b - r) / (max - min)) + 2)[imax == 1]
     # h[imax == 2] = (((r - g) / (max - min)) + 4)[imax == 2]
-    cond = imax.unsqueeze(-3) == _RGB2HSL_IDX
+    cond = imax[..., None, :, :] == _RGB2HSL_IDX
     if image.requires_grad:
-        h = torch.mul((g - b) % 6, torch.select(cond, -3, 0))
+        h = ((g - b) % 6) * cond[..., 0, :, :]
     else:
-        torch.mul((g - b).remainder(6), torch.select(cond, -3, 0), out=h)
-    h += torch.add(b - r, 2) * torch.select(cond, -3, 1)
-    h += torch.add(r - g, 4) * torch.select(cond, -3, 2)
+        # replacing `torch.mul` with `out=h` with python * operator gives wrong results
+        torch.mul((g - b) % 6, cond[..., 0, :, :], out=h)
+    h += (b - r + 2) * cond[..., 1, :, :]
+    h += (r - g + 4) * cond[..., 2, :, :]
     # h = 2.0 * math.pi * (60.0 * h) / 360.0
     h *= math.pi / 3.0  # hue [0, 2*pi]
 
@@ -110,9 +107,9 @@ def hls_to_rgb(image: Tensor) -> Tensor:
     _HLS2RGB = tensor([[[0.0]], [[8.0]], [[4.0]]], device=image.device, dtype=image.dtype)  # 3x1x1
 
     im: Tensor = image.unsqueeze(-4)
-    h: Tensor = torch.select(im, -3, 0)
-    l: Tensor = torch.select(im, -3, 1)
-    s: Tensor = torch.select(im, -3, 2)
+    h: Tensor = im[..., 0, :, :]
+    l: Tensor = im[..., 1, :, :]
+    s: Tensor = im[..., 2, :, :]
     h = h * (6 / math.pi)  # h * 360 / (2 * math.pi) / 30
     a = s * torch.min(l, 1.0 - l)
 


Test patch:
Repository: kornia/kornia

Issue:
Add supported kernel type 'list'
### Describe the bug

Hello,

On the `kornia.augmentation.RandomGaussianBlur` instantiation the package requires to provide kernel as a tuple. However when I use yaml parser to provide kwargs to the class, it is much more convenient to provide a list than a tuple. https://github.com/kornia/kornia/blob/62e331ab4bce327aef80ada7cde2a54595a01fff/kornia/filters/kernels.py#L30 

Since you check provided tuple length in the next line, could you add `list` as a stupported type for kernels, please.

### Reproduction steps

```bash
>>> blur_aug = kornia.augmentation.RandomGaussianBlur(kernel=[0.2, 0.4]...)

[out]: Invalid type: <class 'list'>.
[out]: Kernel size should be an integer or a tuple of integer.
```


### Expected behavior

blur_aug = kornia.augmentation.RandomGaussianBlur(kernel=[0.2, 0.4]...)

OK

### Environment

```shell
Nothing special, I believe.
```


### Additional context

_No response_


Discussion:

Resolving patch:
diff --git a/kornia/filters/kernels.py b/kornia/filters/kernels.py
--- a/kornia/filters/kernels.py
+++ b/kornia/filters/kernels.py
@@ -7,7 +7,7 @@
 import torch
 
 from kornia.core import Device, Dtype, Tensor, concatenate, stack, tensor, where, zeros, zeros_like
-from kornia.core.check import KORNIA_CHECK, KORNIA_CHECK_IS_TENSOR, KORNIA_CHECK_SHAPE, KORNIA_CHECK_TYPE
+from kornia.core.check import KORNIA_CHECK, KORNIA_CHECK_IS_TENSOR, KORNIA_CHECK_SHAPE
 from kornia.utils import deprecated
 
 
@@ -27,8 +27,7 @@ def _unpack_2d_ks(kernel_size: tuple[int, int] | int) -> tuple[int, int]:
     if isinstance(kernel_size, int):
         kx = ky = kernel_size
     else:
-        KORNIA_CHECK_TYPE(kernel_size, tuple, 'Kernel size should be an integer or a tuple of integer.')
-        KORNIA_CHECK(len(kernel_size) == 2, '2D Kernel size tuple should have a length of 2.')
+        KORNIA_CHECK(len(kernel_size) == 2, '2D Kernel size should have a length of 2.')
         kx, ky = kernel_size
 
     kx = int(kx)


Test patch:
diff --git a/test/filters/test_blur.py b/test/filters/test_blur.py
--- a/test/filters/test_blur.py
+++ b/test/filters/test_blur.py
@@ -17,13 +17,10 @@ def test_smoke(self, kernel_size, normalized, device, dtype):
 
     def test_exception(self):
         inpt = torch.rand(1, 1, 3, 3)
-        with pytest.raises(TypeError) as errinfo:
-            box_blur(inpt, '1')
-        assert 'Kernel size should be an integer or a tuple of integer.' in str(errinfo)
 
         with pytest.raises(Exception) as errinfo:
             box_blur(inpt, (1,))
-        assert '2D Kernel size tuple should have a length of 2.' in str(errinfo)
+        assert '2D Kernel size should have a length of 2.' in str(errinfo)
 
     @pytest.mark.parametrize('kernel_size', [(3, 3), 5, (5, 7)])
     @pytest.mark.parametrize('batch_size', [1, 2])
Repository: kornia/kornia

Issue:
Add docs for MobileSAM
## 📚 Documentation

<!-- A clear and concise description of what content in https://kornia.readthedocs.io is an issue. If this has to do with the general https://kornia.org website, please file an issue at https://github.com/kornia/kornia.github.io/issues/new/choose instead. If this has to do with https://kornia.org/tutorials, please file an issue at https://github.com/kornia/tutorials/issues/new -->

Update SAM docs to include MobileSAM. Visual prompter tutorials might need to be updated also.


Discussion:

Resolving patch:
diff --git a/kornia/contrib/models/sam/model.py b/kornia/contrib/models/sam/model.py
--- a/kornia/contrib/models/sam/model.py
+++ b/kornia/contrib/models/sam/model.py
@@ -45,6 +45,7 @@ class SamConfig:
             - 0, 'vit_h' or :func:`kornia.contrib.sam.SamModelType.vit_h`
             - 1, 'vit_l' or :func:`kornia.contrib.sam.SamModelType.vit_l`
             - 2, 'vit_b' or :func:`kornia.contrib.sam.SamModelType.vit_b`
+            - 3, 'mobile_sam', or :func:`kornia.contrib.sam.SamModelType.mobile_sam`
 
         checkpoint: URL or a path for a file with the weights of the model
         encoder_embed_dim: Patch embedding dimension.


Test patch:
Repository: kornia/kornia

Issue:
Next release?
## 🚀 Feature
Hi, when will the next kornia release on conda or pypi be?

## Motivation

Last conda release was in April, and new features have landed since then, but are unavailable in wheels.


Discussion:
@awayfromdog1 we'll release very soon within the next couple of weeks. It's all in place we are polishing some pending additions.

Resolving patch:
diff --git a/kornia/__init__.py b/kornia/__init__.py
--- a/kornia/__init__.py
+++ b/kornia/__init__.py
@@ -13,4 +13,4 @@
 from kornia.utils import eye_like, vec_like, create_meshgrid, image_to_tensor, tensor_to_image
 
 # Version variable
-__version__ = "0.6.13-dev"
+__version__ = "0.7.0"


Test patch:
diff --git a/test/feature/test_matching.py b/test/feature/test_matching.py
--- a/test/feature/test_matching.py
+++ b/test/feature/test_matching.py
@@ -468,8 +468,11 @@ def test_real(self, device, dtype, data):
         assert idxs.shape[0] == dists.shape[0]
         assert dists.shape[0] <= data_dev['descs1'].shape[0]
         assert dists.shape[0] <= data_dev['descs2'].shape[0]
-        expected_idxs = data_dev['lightglue_disk_idxs'].long()
-        assert_close(idxs, expected_idxs, rtol=1e-4, atol=1e-4)
+        # key doesn't exist in data_dev
+        # expected_idxs = data_dev['lightglue_disk_idxs'].long()
+        data_dev['expected_idxs'].long()
+        # TODO: fix this
+        # assert_close(idxs, expected_idxs, rtol=1e-4, atol=1e-4)
 
     @pytest.mark.parametrize("data", ["lightglue_idxs"], indirect=True)
     def test_single_nocrash(self, device, dtype, data):
Repository: kornia/kornia

Issue:
Allow different filling formats
## 🚀 Feature

Warp operators (https://kornia.readthedocs.io/en/latest/geometry.transform.html#warp-operators) should allow fill values for different sizes. For example `warp_perspective` and `warp_affine` should allow filling values for one channel images.

## Motivation

Apply data augmentation in 1 channels images such as grayscale or IR.

## Pitch

Filling value should match the size of the channels rather than asking always to have size 3



Discussion:
@priba isn't this scenario working for you ? maybe it's a docu typo
https://github.com/kornia/kornia/blob/master/kornia/geometry/transform/imgwarp.py#L222
There is a `ValueError` just before this function is called. Maybe it works but I guess it might need to be properly tested that removing the `raise` do not effect anything else.

See: https://github.com/kornia/kornia/blob/4cd9a61f50c4661d829a15703ca86260012d30e2/kornia/geometry/transform/imgwarp.py#L190 

Resolving patch:
diff --git a/kornia/geometry/transform/imgwarp.py b/kornia/geometry/transform/imgwarp.py
--- a/kornia/geometry/transform/imgwarp.py
+++ b/kornia/geometry/transform/imgwarp.py
@@ -184,11 +184,6 @@ def warp_affine(
     if not (len(M.shape) == 3 or M.shape[-2:] == (2, 3)):
         raise ValueError(f"Input M must be a Bx2x3 tensor. Got {M.shape}")
 
-    # fill padding is only supported for 3 channels because we can't set fill_value default
-    # to None as this gives jit issues.
-    if padding_mode == "fill" and fill_value.shape != torch.Size([3]):
-        raise ValueError(f"Padding_tensor only supported for 3 channels. Got {fill_value.shape}")
-
     B, C, H, W = src.size()
 
     # we generate a 3x3 transformation matrix from 2x3 affine
@@ -202,6 +197,7 @@ def warp_affine(
 
     if padding_mode == "fill":
         return _fill_and_warp(src, grid, align_corners=align_corners, mode=mode, fill_value=fill_value)
+
     return F.grid_sample(src, grid, align_corners=align_corners, mode=mode, padding_mode=padding_mode)
 
 


Test patch:
diff --git a/test/geometry/transform/test_imgwarp.py b/test/geometry/transform/test_imgwarp.py
--- a/test/geometry/transform/test_imgwarp.py
+++ b/test/geometry/transform/test_imgwarp.py
@@ -253,6 +253,21 @@ def test_fill_padding_translation(self, device, dtype):
         assert_close(top_row_mean, fill_value)
         assert_close(first_col_mean, fill_value)
 
+    @pytest.mark.parametrize("num_channels", [1, 3, 5])
+    def test_fill_padding_channels(self, device, dtype, num_channels):
+        offset = 1.0
+        h, w = 3, 4
+        aff_ab = torch.eye(2, 3, device=device, dtype=dtype)[None]
+        aff_ab[..., -1] += offset
+
+        img_b = torch.arange(float(num_channels * h * w), device=device, dtype=dtype).view(1, num_channels, h, w)
+
+        fill_value = torch.zeros(num_channels, device=device, dtype=dtype)
+
+        img_a = kornia.geometry.warp_affine(img_b, aff_ab, (h, w), padding_mode="fill", fill_value=fill_value)
+
+        assert_close(img_a[:, :, :1, :1].squeeze(), fill_value.squeeze())
+
 
 class TestWarpPerspective:
     def test_smoke(self, device, dtype):
Repository: kornia/kornia

Issue:
expose `average_endpoint_error` on `kornia.metrics.__init__.py`
              can you expose it on kornia.metrics.__init__.py ? - to use as `kornia.metrics.average_endpoint_error` too

_Originally posted by @johnnv1 in https://github.com/kornia/kornia/pull/2615#discussion_r1351007042_
            


Discussion:

Resolving patch:
diff --git a/kornia/metrics/__init__.py b/kornia/metrics/__init__.py
--- a/kornia/metrics/__init__.py
+++ b/kornia/metrics/__init__.py
@@ -1,7 +1,7 @@
 from .accuracy import accuracy
 from .average_meter import AverageMeter
 from .confusion_matrix import confusion_matrix
-from .endpoint_error import AEPE, aepe
+from .endpoint_error import AEPE, aepe, average_endpoint_error
 from .mean_average_precision import mean_average_precision
 from .mean_iou import mean_iou, mean_iou_bbox
 from .psnr import psnr
@@ -14,6 +14,7 @@
     "confusion_matrix",
     "aepe",
     "AEPE",
+    "average_endpoint_error",
     "mean_iou",
     "mean_iou_bbox",
     "mean_average_precision",


Test patch:
diff --git a/test/test_metrics.py b/test/test_metrics.py
--- a/test/test_metrics.py
+++ b/test/test_metrics.py
@@ -225,7 +225,7 @@ def test_aepe_alias(self, device, dtype):
         sample = torch.ones(4, 4, 2, device=device, dtype=dtype)
         expected = torch.zeros(4, 4, device=device, dtype=dtype)
         actual_aepe = kornia.metrics.aepe(sample, sample, reduction="none")
-        actual_alias = kornia.metrics.endpoint_error.average_endpoint_error(sample, sample, reduction="none")
+        actual_alias = kornia.metrics.average_endpoint_error(sample, sample, reduction="none")
         assert_close(actual_aepe, expected)
         assert_close(actual_alias, expected)
         assert_close(actual_aepe, actual_alias)
Repository: kornia/kornia

Issue:
torch.solve should be always float64
### Describe the bug

As reported by @Parskatt  in https://github.com/pytorch/vision/issues/8248 for torchvision, solving in float32 is unstable. 
Kornia has the same issue

### Reproduction steps

```bash
https://twitter.com/Parskatt/status/1753389458479608315
```


### Expected behavior

-

### Environment

```shell
n/a
```


### Additional context

_No response_


Discussion:

Resolving patch:
diff --git a/kornia/utils/helpers.py b/kornia/utils/helpers.py
--- a/kornia/utils/helpers.py
+++ b/kornia/utils/helpers.py
@@ -229,11 +229,11 @@ def _torch_solve_cast(A: Tensor, B: Tensor) -> Tensor:
     The function torch.solve is only implemented for fp32/64 which makes impossible to be used by fp16 or others. What
     this function does, is cast input data type to fp32, apply torch.svd, and cast back to the input dtype.
     """
-    dtype: torch.dtype = A.dtype
-    if dtype not in (torch.float32, torch.float64):
-        dtype = torch.float32
+    # dtype: torch.dtype = A.dtype
+    # if dtype not in (torch.float32, torch.float64):
+    #    dtype = torch.float32
 
-    out = torch.linalg.solve(A.to(dtype), B.to(dtype))
+    out = torch.linalg.solve(A.to(torch.float64), B.to(torch.float64))
 
     return out.to(A.dtype)
 


Test patch:
diff --git a/tests/geometry/transform/test_thin_plate_spline.py b/tests/geometry/transform/test_thin_plate_spline.py
--- a/tests/geometry/transform/test_thin_plate_spline.py
+++ b/tests/geometry/transform/test_thin_plate_spline.py
@@ -3,7 +3,6 @@
 from torch.autograd import gradcheck
 
 import kornia
-from kornia.utils._compat import torch_version_ge
 
 from testing.base import assert_close
 
@@ -154,12 +153,9 @@ def test_smoke(self, batch_size, device, dtype):
         warp = kornia.geometry.transform.warp_image_tps(tensor, dst, kernel, affine)
         assert warp.shape == tensor.shape
 
-    @pytest.mark.skipif(
-        torch_version_ge(1, 10), reason="for some reason the solver detects singular matrices in pytorch >=1.10."
-    )
     @pytest.mark.parametrize("batch_size", [1, 3])
     def test_warp(self, batch_size, device, dtype):
-        src = torch.tensor([[[-1.0, -1.0], [-1.0, 1.0], [1.0, -1.0], [1.0, -1.0], [0.0, 0.0]]], device=device).repeat(
+        src = torch.tensor([[[-1.0, -1.0], [-1.0, 1.0], [1.0, -1.0], [1.0, 1.0], [0.0, 0.0]]], device=device).repeat(
             batch_size, 1, 1
         )
         # zoom in by a factor of 2
Repository: kornia/kornia

Issue:
Important typo in RandAugment default policy list
### Describe the bug

'translate_x' is in the default policy list twice, whereas 'translate_y' is missing.

### Reproduction steps

```bash
1. Open kornia/augmentation/auto/rand_augment/rand_augment.py
```


### Expected behavior

Current default_policy list:
```
default_policy: List[SUBPLOLICY_CONFIG] = [
    [("auto_contrast", 0, 1)],
    [("equalize", 0, 1)],
    [("invert", 0, 1)],
    [("rotate", -30.0, 30.0)],
    [("posterize", 0.0, 4)],
    [("solarize", 0.0, 1.0)],
    [("solarize_add", 0.0, 0.43)],
    [("color", 0.1, 1.9)],
    [("contrast", 0.1, 1.9)],
    [("brightness", 0.1, 1.9)],
    [("sharpness", 0.1, 1.9)],
    [("shear_x", -0.3, 0.3)],
    [("shear_y", -0.3, 0.3)],
    # (CutoutAbs, 0, 40),
    [("translate_x", -0.1, 0.1)],
    [("translate_x", -0.1, 0.1)],
]
```

Expected list:
```
default_policy: List[SUBPLOLICY_CONFIG] = [
    [("auto_contrast", 0, 1)],
    [("equalize", 0, 1)],
    [("invert", 0, 1)],
    [("rotate", -30.0, 30.0)],
    [("posterize", 0.0, 4)],
    [("solarize", 0.0, 1.0)],
    [("solarize_add", 0.0, 0.43)],
    [("color", 0.1, 1.9)],
    [("contrast", 0.1, 1.9)],
    [("brightness", 0.1, 1.9)],
    [("sharpness", 0.1, 1.9)],
    [("shear_x", -0.3, 0.3)],
    [("shear_y", -0.3, 0.3)],
    # (CutoutAbs, 0, 40),
    [("translate_x", -0.1, 0.1)],
    [("translate_y", -0.1, 0.1)],
]
```

### Environment

```shell
Irrelevant
```


### Additional context

_No response_


Discussion:
@Tomsen1410 thanks to raise the issue. Could you send a PR to fix ? from here i also see another type `SUBPLOLICY_CONFIG` -> `SUBPOLICY_CONFIG` :)
Can I work on this issue
@SarthakNikhal please, go ahead 

Resolving patch:
diff --git a/kornia/augmentation/auto/rand_augment/rand_augment.py b/kornia/augmentation/auto/rand_augment/rand_augment.py
--- a/kornia/augmentation/auto/rand_augment/rand_augment.py
+++ b/kornia/augmentation/auto/rand_augment/rand_augment.py
@@ -27,7 +27,7 @@
     [("shear_y", -0.3, 0.3)],
     # (CutoutAbs, 0, 40),
     [("translate_x", -0.1, 0.1)],
-    [("translate_x", -0.1, 0.1)],
+    [("translate_y", -0.1, 0.1)],
 ]
 
 


Test patch:
Repository: kornia/kornia

Issue:
Replace Kmeans `euclidean_distance` method by `kornia.geometry.linalg.euclidean_distance`
              you can use existing `euclidean_distance`: https://github.com/kornia/kornia/blob/69a697020a5f63ba7d46369673709c4f23d72313/kornia/geometry/linalg.py#L241

_Originally posted by @edgarriba in https://github.com/kornia/kornia/pull/2804#discussion_r1489182309_

For that needs to remove the line https://github.com/kornia/kornia/blob/69a697020a5f63ba7d46369673709c4f23d72313/kornia/geometry/linalg.py#L254

On Kmeans internals, we also may be able to replace a sum of the distances: 
> probably here we can reuse the euclidean distance routine if we adjust the function to pass the reduction axis ?

_Originally posted by @edgarriba in https://github.com/kornia/kornia/pull/2804#discussion_r1489184226_


Discussion:
HI! Newbie to OSS. Can I work on your issue?
> HI! Newbie to OSS. Can I work on your issue?

Sure, If you have any questions, just call us on Slack, or open a PR for discussion

Resolving patch:
diff --git a/kornia/contrib/kmeans.py b/kornia/contrib/kmeans.py
--- a/kornia/contrib/kmeans.py
+++ b/kornia/contrib/kmeans.py
@@ -6,6 +6,7 @@
 
 from kornia.core import Tensor
 from kornia.core.check import KORNIA_CHECK, KORNIA_CHECK_SHAPE
+from kornia.geometry.linalg import euclidean_distance
 
 
 class KMeans:
@@ -95,9 +96,7 @@ def _pairwise_euclidean_distance(self, data1: Tensor, data2: Tensor) -> Tensor:
         A = data1[:, None, ...]
         # 1*C*D
         B = data2[None, ...]
-        distance = (A - B) ** 2.0
-        # return N*C matrix for pairwise distance
-        distance = distance.sum(dim=-1)
+        distance = euclidean_distance(A, B)
         return distance
 
     def fit(self, X: Tensor) -> None:
diff --git a/kornia/geometry/linalg.py b/kornia/geometry/linalg.py
--- a/kornia/geometry/linalg.py
+++ b/kornia/geometry/linalg.py
@@ -3,7 +3,7 @@
 import torch
 
 from kornia.core import Tensor, zeros_like
-from kornia.core.check import KORNIA_CHECK, KORNIA_CHECK_IS_TENSOR, KORNIA_CHECK_SHAPE
+from kornia.core.check import KORNIA_CHECK_IS_TENSOR, KORNIA_CHECK_SHAPE
 from kornia.geometry.conversions import convert_points_from_homogeneous, convert_points_to_homogeneous
 
 __all__ = [
@@ -251,7 +251,6 @@ def euclidean_distance(x: Tensor, y: Tensor, keepdim: bool = False, eps: float =
     """
     KORNIA_CHECK_SHAPE(x, ["*", "N"])
     KORNIA_CHECK_SHAPE(y, ["*", "N"])
-    KORNIA_CHECK(x.shape == y.shape)
 
     return (x - y + eps).pow(2).sum(-1, keepdim).sqrt()
 


Test patch:
Repository: kornia/kornia

Issue:
RANSAC.max_samples_by_conf returns negative numbers
### Describe the bug

This code fails

`
from kornia.geometry import RANSAC

x = RANSAC.max_samples_by_conf(n_inl=100, num_tc=1000, sample_size=7, conf=0.99)
assert x > 0.0
`


### Reproduction steps

```bash
from kornia.geometry import RANSAC

x = RANSAC.max_samples_by_conf(n_inl=100, num_tc=1000, sample_size=7, conf=0.99)
assert x > 0.0
```


### Expected behavior

The returned value should always be positive

### Environment

```shell
Environment agnostic
```


### Additional context

a one-line bugfix will shortly follow


Discussion:

Resolving patch:
diff --git a/kornia/geometry/ransac.py b/kornia/geometry/ransac.py
--- a/kornia/geometry/ransac.py
+++ b/kornia/geometry/ransac.py
@@ -103,7 +103,7 @@ def max_samples_by_conf(n_inl: int, num_tc: int, sample_size: int, conf: float)
             return 1.0
         if n_inl == num_tc:
             return 1.0
-        return math.log(1.0 - conf) / max(eps, math.log(max(eps, 1.0 - math.pow(n_inl / num_tc, sample_size))))
+        return math.log(1.0 - conf) / min(-eps, math.log(max(eps, 1.0 - math.pow(n_inl / num_tc, sample_size))))
 
     def estimate_model_from_minsample(self, kp1: Tensor, kp2: Tensor) -> Tensor:
         batch_size, sample_size = kp1.shape[:2]


Test patch:
diff --git a/tests/geometry/test_ransac.py b/tests/geometry/test_ransac.py
--- a/tests/geometry/test_ransac.py
+++ b/tests/geometry/test_ransac.py
@@ -1,3 +1,5 @@
+import math
+
 import pytest
 import torch
 
@@ -241,3 +243,17 @@ def gradfun(p1, p2):
             return model(p1, p2)[0]
 
         self.gradcheck(gradfun, (points1, points2), fast_mode=False, requires_grad=(True, False, False))
+
+
+class TestRansacMethods:
+    def test_max_samples_by_conf(self):
+        conf = 0.99
+        eps = 1e-9
+
+        x = RANSAC.max_samples_by_conf(n_inl=1, num_tc=1000, sample_size=7, conf=conf)
+        assert x > 0.0
+        assert x == math.log(1.0 - conf) / -eps
+
+        x = RANSAC.max_samples_by_conf(n_inl=999999999, num_tc=1000000000, sample_size=1, conf=conf)
+        assert x > 0.0
+        assert x == math.log(1.0 - conf) / math.log(eps)