prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Broken link "InvDepthSmoothnessLoss"
  ## 📚 Documentation
  
  In the documentation of this function https://kornia.readthedocs.io/en/latest/losses.html#kornia.losses.inverse_depth_smoothness_loss, the link is broken.
  
  ```See InvDepthSmoothnessLoss for details.```
  
  The error is due to an incorrect name. The correct name should be `InverseDepthSmoothnessLoss`.
  
  
  
  </issue>
  <code>
  [start of kornia/losses/depth_smooth.py]
  1 import torch
  2 import torch.nn as nn
  3 import torch.nn.functional as F
  4 
  5 # Based on
  6 # https://github.com/tensorflow/models/blob/master/research/struct2depth/model.py#L625-L641
  7 
  8 
  9 def _gradient_x(img: torch.Tensor) -> torch.Tensor:
  10     assert len(img.shape) == 4, img.shape
  11     return img[:, :, :, :-1] - img[:, :, :, 1:]
  12 
  13 
  14 def _gradient_y(img: torch.Tensor) -> torch.Tensor:
  15     assert len(img.shape) == 4, img.shape
  16     return img[:, :, :-1, :] - img[:, :, 1:, :]
  17 
  18 
  19 def inverse_depth_smoothness_loss(
  20         idepth: torch.Tensor,
  21         image: torch.Tensor) -> torch.Tensor:
  22     r"""Computes image-aware inverse depth smoothness loss.
  23 
  24     See :class:`~kornia.losses.InvDepthSmoothnessLoss` for details.
  25     """
  26     if not torch.is_tensor(idepth):
  27         raise TypeError("Input idepth type is not a torch.Tensor. Got {}"
  28                         .format(type(idepth)))
  29 
  30     if not torch.is_tensor(image):
  31         raise TypeError("Input image type is not a torch.Tensor. Got {}"
  32                         .format(type(image)))
  33 
  34     if not len(idepth.shape) == 4:
  35         raise ValueError("Invalid idepth shape, we expect BxCxHxW. Got: {}"
  36                          .format(idepth.shape))
  37 
  38     if not len(image.shape) == 4:
  39         raise ValueError("Invalid image shape, we expect BxCxHxW. Got: {}"
  40                          .format(image.shape))
  41 
  42     if not idepth.shape[-2:] == image.shape[-2:]:
  43         raise ValueError("idepth and image shapes must be the same. Got: {} and {}"
  44                          .format(idepth.shape, image.shape))
  45 
  46     if not idepth.device == image.device:
  47         raise ValueError(
  48             "idepth and image must be in the same device. Got: {} and {}" .format(
  49                 idepth.device, image.device))
  50 
  51     if not idepth.dtype == image.dtype:
  52         raise ValueError(
  53             "idepth and image must be in the same dtype. Got: {} and {}" .format(
  54                 idepth.dtype, image.dtype))
  55 
  56     # compute the gradients
  57     idepth_dx: torch.Tensor = _gradient_x(idepth)
  58     idepth_dy: torch.Tensor = _gradient_y(idepth)
  59     image_dx: torch.Tensor = _gradient_x(image)
  60     image_dy: torch.Tensor = _gradient_y(image)
  61 
  62     # compute image weights
  63     weights_x: torch.Tensor = torch.exp(
  64         -torch.mean(torch.abs(image_dx), dim=1, keepdim=True))
  65     weights_y: torch.Tensor = torch.exp(
  66         -torch.mean(torch.abs(image_dy), dim=1, keepdim=True))
  67 
  68     # apply image weights to depth
  69     smoothness_x: torch.Tensor = torch.abs(idepth_dx * weights_x)
  70     smoothness_y: torch.Tensor = torch.abs(idepth_dy * weights_y)
  71     return torch.mean(smoothness_x) + torch.mean(smoothness_y)
  72 
  73 
  74 class InverseDepthSmoothnessLoss(nn.Module):
  75     r"""Criterion that computes image-aware inverse depth smoothness loss.
  76 
  77     .. math::
  78 
  79         \text{loss} = \left | \partial_x d_{ij} \right | e^{-\left \|
  80         \partial_x I_{ij} \right \|} + \left |
  81         \partial_y d_{ij} \right | e^{-\left \| \partial_y I_{ij} \right \|}
  82 
  83 
  84     Shape:
  85         - Inverse Depth: :math:`(N, 1, H, W)`
  86         - Image: :math:`(N, 3, H, W)`
  87         - Output: scalar
  88 
  89     Examples::
  90 
  91         >>> idepth = torch.rand(1, 1, 4, 5)
  92         >>> image = torch.rand(1, 3, 4, 5)
  93         >>> smooth = kornia.losses.DepthSmoothnessLoss()
  94         >>> loss = smooth(idepth, image)
  95     """
  96 
  97     def __init__(self) -> None:
  98         super(InverseDepthSmoothnessLoss, self).__init__()
  99 
  100     def forward(self, idepth: torch.Tensor, image: torch.Tensor) -> torch.Tensor:  # type:ignore
  101         return inverse_depth_smoothness_loss(idepth, image)
  102
  [end of kornia/losses/depth_smooth.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/kornia/losses/depth_smooth.py b/kornia/losses/depth_smooth.py
  --- a/kornia/losses/depth_smooth.py
  +++ b/kornia/losses/depth_smooth.py
  @@ -21,7 +21,7 @@
           image: torch.Tensor) -> torch.Tensor:
       r"""Computes image-aware inverse depth smoothness loss.
   
  -    See :class:`~kornia.losses.InvDepthSmoothnessLoss` for details.
  +    See :class:`~kornia.losses.InverseDepthSmoothnessLoss` for details.
       """
       if not torch.is_tensor(idepth):
           raise TypeError("Input idepth type is not a torch.Tensor. Got {}"
  
verification_info: {"golden_diff": "diff --git a/kornia/losses/depth_smooth.py b/kornia/losses/depth_smooth.py\n--- a/kornia/losses/depth_smooth.py\n+++ b/kornia/losses/depth_smooth.py\n@@ -21,7 +21,7 @@\n         image: torch.Tensor) -> torch.Tensor:\n     r\"\"\"Computes image-aware inverse depth smoothness loss.\n \n-    See :class:`~kornia.losses.InvDepthSmoothnessLoss` for details.\n+    See :class:`~kornia.losses.InverseDepthSmoothnessLoss` for details.\n     \"\"\"\n     if not torch.is_tensor(idepth):\n         raise TypeError(\"Input idepth type is not a torch.Tensor. Got {}\"\n", "issue": "Broken link \"InvDepthSmoothnessLoss\"\n## \ud83d\udcda Documentation\r\n\r\nIn the documentation of this function https://kornia.readthedocs.io/en/latest/losses.html#kornia.losses.inverse_depth_smoothness_loss, the link is broken.\r\n\r\n```See InvDepthSmoothnessLoss for details.```\r\n\r\nThe error is due to an incorrect name. The correct name should be `InverseDepthSmoothnessLoss`.\r\n\r\n\n", "before_files": [{"content": "import torch\nimport torch.nn as nn\nimport torch.nn.functional as F\n\n# Based on\n# https://github.com/tensorflow/models/blob/master/research/struct2depth/model.py#L625-L641\n\n\ndef _gradient_x(img: torch.Tensor) -> torch.Tensor:\n    assert len(img.shape) == 4, img.shape\n    return img[:, :, :, :-1] - img[:, :, :, 1:]\n\n\ndef _gradient_y(img: torch.Tensor) -> torch.Tensor:\n    assert len(img.shape) == 4, img.shape\n    return img[:, :, :-1, :] - img[:, :, 1:, :]\n\n\ndef inverse_depth_smoothness_loss(\n        idepth: torch.Tensor,\n        image: torch.Tensor) -> torch.Tensor:\n    r\"\"\"Computes image-aware inverse depth smoothness loss.\n\n    See :class:`~kornia.losses.InvDepthSmoothnessLoss` for details.\n    \"\"\"\n    if not torch.is_tensor(idepth):\n        raise TypeError(\"Input idepth type is not a torch.Tensor. Got {}\"\n                        .format(type(idepth)))\n\n    if not torch.is_tensor(image):\n        raise TypeError(\"Input image type is not a torch.Tensor. Got {}\"\n                        .format(type(image)))\n\n    if not len(idepth.shape) == 4:\n        raise ValueError(\"Invalid idepth shape, we expect BxCxHxW. Got: {}\"\n                         .format(idepth.shape))\n\n    if not len(image.shape) == 4:\n        raise ValueError(\"Invalid image shape, we expect BxCxHxW. Got: {}\"\n                         .format(image.shape))\n\n    if not idepth.shape[-2:] == image.shape[-2:]:\n        raise ValueError(\"idepth and image shapes must be the same. Got: {} and {}\"\n                         .format(idepth.shape, image.shape))\n\n    if not idepth.device == image.device:\n        raise ValueError(\n            \"idepth and image must be in the same device. Got: {} and {}\" .format(\n                idepth.device, image.device))\n\n    if not idepth.dtype == image.dtype:\n        raise ValueError(\n            \"idepth and image must be in the same dtype. Got: {} and {}\" .format(\n                idepth.dtype, image.dtype))\n\n    # compute the gradients\n    idepth_dx: torch.Tensor = _gradient_x(idepth)\n    idepth_dy: torch.Tensor = _gradient_y(idepth)\n    image_dx: torch.Tensor = _gradient_x(image)\n    image_dy: torch.Tensor = _gradient_y(image)\n\n    # compute image weights\n    weights_x: torch.Tensor = torch.exp(\n        -torch.mean(torch.abs(image_dx), dim=1, keepdim=True))\n    weights_y: torch.Tensor = torch.exp(\n        -torch.mean(torch.abs(image_dy), dim=1, keepdim=True))\n\n    # apply image weights to depth\n    smoothness_x: torch.Tensor = torch.abs(idepth_dx * weights_x)\n    smoothness_y: torch.Tensor = torch.abs(idepth_dy * weights_y)\n    return torch.mean(smoothness_x) + torch.mean(smoothness_y)\n\n\nclass InverseDepthSmoothnessLoss(nn.Module):\n    r\"\"\"Criterion that computes image-aware inverse depth smoothness loss.\n\n    .. math::\n\n        \\text{loss} = \\left | \\partial_x d_{ij} \\right | e^{-\\left \\|\n        \\partial_x I_{ij} \\right \\|} + \\left |\n        \\partial_y d_{ij} \\right | e^{-\\left \\| \\partial_y I_{ij} \\right \\|}\n\n\n    Shape:\n        - Inverse Depth: :math:`(N, 1, H, W)`\n        - Image: :math:`(N, 3, H, W)`\n        - Output: scalar\n\n    Examples::\n\n        >>> idepth = torch.rand(1, 1, 4, 5)\n        >>> image = torch.rand(1, 3, 4, 5)\n        >>> smooth = kornia.losses.DepthSmoothnessLoss()\n        >>> loss = smooth(idepth, image)\n    \"\"\"\n\n    def __init__(self) -> None:\n        super(InverseDepthSmoothnessLoss, self).__init__()\n\n    def forward(self, idepth: torch.Tensor, image: torch.Tensor) -> torch.Tensor:  # type:ignore\n        return inverse_depth_smoothness_loss(idepth, image)\n", "path": "kornia/losses/depth_smooth.py"}]}