prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  RBF Kernel Change Breaks Testing Code
  The change to RBFKernel in 84fccd898c45c08279fb5c109e6e234f3a47588a may break something about our prediction code. 
  
  I am not totally sure what the problem is yet, but I isolated this as the problem with `git bisect` and have a reasonable test case where results are significantly worse with the commit in compared to after a revert commit. 
  
  It seems like the stability issues we encountered when making this change in the past don't come up in the unit tests, but do on some real datasets.
  
  I can try to push my test case to a branch as well, although it relies on a UCI dataset.
  
  @Balandat @gpleiss 
  
  </issue>
  <code>
  [start of gpytorch/kernels/rbf_kernel.py]
  1 from __future__ import absolute_import
  2 from __future__ import division
  3 from __future__ import print_function
  4 from __future__ import unicode_literals
  5 
  6 from .kernel import Kernel
  7 
  8 
  9 class RBFKernel(Kernel):
  10 
  11     def __init__(
  12         self,
  13         ard_num_dims=None,
  14         log_lengthscale_bounds=(-10000, 10000),
  15         eps=1e-5,
  16         active_dims=None,
  17     ):
  18         super(RBFKernel, self).__init__(
  19             has_lengthscale=True,
  20             ard_num_dims=ard_num_dims,
  21             log_lengthscale_bounds=log_lengthscale_bounds,
  22             active_dims=active_dims,
  23         )
  24         self.eps = eps
  25 
  26     def forward(self, x1, x2):
  27         lengthscales = self.log_lengthscale.exp() + self.eps
  28         diff = (x1.unsqueeze(2) - x2.unsqueeze(1)).div_(lengthscales)
  29         return diff.pow_(2).sum(-1).mul_(-0.5).exp_()
  30
  [end of gpytorch/kernels/rbf_kernel.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/gpytorch/kernels/rbf_kernel.py b/gpytorch/kernels/rbf_kernel.py
  --- a/gpytorch/kernels/rbf_kernel.py
  +++ b/gpytorch/kernels/rbf_kernel.py
  @@ -3,6 +3,7 @@
   from __future__ import print_function
   from __future__ import unicode_literals
   
  +import math
   from .kernel import Kernel
   
   
  @@ -12,7 +13,7 @@
           self,
           ard_num_dims=None,
           log_lengthscale_bounds=(-10000, 10000),
  -        eps=1e-5,
  +        eps=1e-6,
           active_dims=None,
       ):
           super(RBFKernel, self).__init__(
  @@ -24,6 +25,6 @@
           self.eps = eps
   
       def forward(self, x1, x2):
  -        lengthscales = self.log_lengthscale.exp() + self.eps
  +        lengthscales = self.log_lengthscale.exp().mul(math.sqrt(2)).clamp(self.eps, 1e5)
           diff = (x1.unsqueeze(2) - x2.unsqueeze(1)).div_(lengthscales)
  -        return diff.pow_(2).sum(-1).mul_(-0.5).exp_()
  +        return diff.pow_(2).sum(-1).mul_(-1).exp_()
  
verification_info: {"golden_diff": "diff --git a/gpytorch/kernels/rbf_kernel.py b/gpytorch/kernels/rbf_kernel.py\n--- a/gpytorch/kernels/rbf_kernel.py\n+++ b/gpytorch/kernels/rbf_kernel.py\n@@ -3,6 +3,7 @@\n from __future__ import print_function\n from __future__ import unicode_literals\n \n+import math\n from .kernel import Kernel\n \n \n@@ -12,7 +13,7 @@\n         self,\n         ard_num_dims=None,\n         log_lengthscale_bounds=(-10000, 10000),\n-        eps=1e-5,\n+        eps=1e-6,\n         active_dims=None,\n     ):\n         super(RBFKernel, self).__init__(\n@@ -24,6 +25,6 @@\n         self.eps = eps\n \n     def forward(self, x1, x2):\n-        lengthscales = self.log_lengthscale.exp() + self.eps\n+        lengthscales = self.log_lengthscale.exp().mul(math.sqrt(2)).clamp(self.eps, 1e5)\n         diff = (x1.unsqueeze(2) - x2.unsqueeze(1)).div_(lengthscales)\n-        return diff.pow_(2).sum(-1).mul_(-0.5).exp_()\n+        return diff.pow_(2).sum(-1).mul_(-1).exp_()\n", "issue": "RBF Kernel Change Breaks Testing Code\nThe change to RBFKernel in 84fccd898c45c08279fb5c109e6e234f3a47588a may break something about our prediction code. \r\n\r\nI am not totally sure what the problem is yet, but I isolated this as the problem with `git bisect` and have a reasonable test case where results are significantly worse with the commit in compared to after a revert commit. \r\n\r\nIt seems like the stability issues we encountered when making this change in the past don't come up in the unit tests, but do on some real datasets.\r\n\r\nI can try to push my test case to a branch as well, although it relies on a UCI dataset.\r\n\r\n@Balandat @gpleiss \n", "before_files": [{"content": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nfrom .kernel import Kernel\n\n\nclass RBFKernel(Kernel):\n\n    def __init__(\n        self,\n        ard_num_dims=None,\n        log_lengthscale_bounds=(-10000, 10000),\n        eps=1e-5,\n        active_dims=None,\n    ):\n        super(RBFKernel, self).__init__(\n            has_lengthscale=True,\n            ard_num_dims=ard_num_dims,\n            log_lengthscale_bounds=log_lengthscale_bounds,\n            active_dims=active_dims,\n        )\n        self.eps = eps\n\n    def forward(self, x1, x2):\n        lengthscales = self.log_lengthscale.exp() + self.eps\n        diff = (x1.unsqueeze(2) - x2.unsqueeze(1)).div_(lengthscales)\n        return diff.pow_(2).sum(-1).mul_(-0.5).exp_()\n", "path": "gpytorch/kernels/rbf_kernel.py"}]}