prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  [Bug] The Added Loss term for InducingKernel seems flipped in sign?
  # 🐛 Bug
  
  <!-- A clear and concise description of what the bug is. -->
  ```
      def loss(self, *params):
          prior_covar = self.prior_dist.lazy_covariance_matrix
          variational_covar = self.variational_dist.lazy_covariance_matrix
          diag = prior_covar.diag() - variational_covar.diag()
          shape = prior_covar.shape[:-1]
          noise_diag = self.likelihood._shaped_noise_covar(shape, *params).diag()
          return 0.5 * (diag / noise_diag).sum()
  ```
  This is the current code for InducingPointKernelAddedLossTerm.loss
  
  From what I see, this "loss term" is added into the mll that is returned by the `ExactMarginalLogLikelihood` class. This in itself is misleading as the loss is usually the negative of the mll.
  
  Moreover, the variational negative loss used to evaluate inducing points is given below
  
  ![image](https://user-images.githubusercontent.com/4582526/122106510-4c545980-ce1a-11eb-9bbc-681bea511bec.png)
  
  As can be seen, the above is the expression for the pseudo-mll that is maximized when optimizing the inducing points. in this, the component of `InducingPointKernelAddedLossTerm` is negative to the value that is being added into the loss.
  
  This is quite likely a significant bug. Please fix (just invert the sign of `diag` above)
  
  
  </issue>
  <code>
  [start of gpytorch/mlls/inducing_point_kernel_added_loss_term.py]
  1 #!/usr/bin/env python3
  2 
  3 from .added_loss_term import AddedLossTerm
  4 
  5 
  6 class InducingPointKernelAddedLossTerm(AddedLossTerm):
  7     def __init__(self, variational_dist, prior_dist, likelihood):
  8         self.prior_dist = prior_dist
  9         self.variational_dist = variational_dist
  10         self.likelihood = likelihood
  11 
  12     def loss(self, *params):
  13         prior_covar = self.prior_dist.lazy_covariance_matrix
  14         variational_covar = self.variational_dist.lazy_covariance_matrix
  15         diag = prior_covar.diag() - variational_covar.diag()
  16         shape = prior_covar.shape[:-1]
  17         noise_diag = self.likelihood._shaped_noise_covar(shape, *params).diag()
  18         return 0.5 * (diag / noise_diag).sum()
  19
  [end of gpytorch/mlls/inducing_point_kernel_added_loss_term.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/mlls/inducing_point_kernel_added_loss_term.py b/gpytorch/mlls/inducing_point_kernel_added_loss_term.py
  --- a/gpytorch/mlls/inducing_point_kernel_added_loss_term.py
  +++ b/gpytorch/mlls/inducing_point_kernel_added_loss_term.py
  @@ -4,7 +4,7 @@
   
   
   class InducingPointKernelAddedLossTerm(AddedLossTerm):
  -    def __init__(self, variational_dist, prior_dist, likelihood):
  +    def __init__(self, prior_dist, variational_dist, likelihood):
           self.prior_dist = prior_dist
           self.variational_dist = variational_dist
           self.likelihood = likelihood
  @@ -12,7 +12,7 @@
       def loss(self, *params):
           prior_covar = self.prior_dist.lazy_covariance_matrix
           variational_covar = self.variational_dist.lazy_covariance_matrix
  -        diag = prior_covar.diag() - variational_covar.diag()
  +        diag = variational_covar.diag() - prior_covar.diag()
           shape = prior_covar.shape[:-1]
           noise_diag = self.likelihood._shaped_noise_covar(shape, *params).diag()
           return 0.5 * (diag / noise_diag).sum()
  
verification_info: {"golden_diff": "diff --git a/gpytorch/mlls/inducing_point_kernel_added_loss_term.py b/gpytorch/mlls/inducing_point_kernel_added_loss_term.py\n--- a/gpytorch/mlls/inducing_point_kernel_added_loss_term.py\n+++ b/gpytorch/mlls/inducing_point_kernel_added_loss_term.py\n@@ -4,7 +4,7 @@\n \n \n class InducingPointKernelAddedLossTerm(AddedLossTerm):\n-    def __init__(self, variational_dist, prior_dist, likelihood):\n+    def __init__(self, prior_dist, variational_dist, likelihood):\n         self.prior_dist = prior_dist\n         self.variational_dist = variational_dist\n         self.likelihood = likelihood\n@@ -12,7 +12,7 @@\n     def loss(self, *params):\n         prior_covar = self.prior_dist.lazy_covariance_matrix\n         variational_covar = self.variational_dist.lazy_covariance_matrix\n-        diag = prior_covar.diag() - variational_covar.diag()\n+        diag = variational_covar.diag() - prior_covar.diag()\n         shape = prior_covar.shape[:-1]\n         noise_diag = self.likelihood._shaped_noise_covar(shape, *params).diag()\n         return 0.5 * (diag / noise_diag).sum()\n", "issue": "[Bug] The Added Loss term for InducingKernel seems flipped in sign?\n# \ud83d\udc1b Bug\r\n\r\n<!-- A clear and concise description of what the bug is. -->\r\n```\r\n    def loss(self, *params):\r\n        prior_covar = self.prior_dist.lazy_covariance_matrix\r\n        variational_covar = self.variational_dist.lazy_covariance_matrix\r\n        diag = prior_covar.diag() - variational_covar.diag()\r\n        shape = prior_covar.shape[:-1]\r\n        noise_diag = self.likelihood._shaped_noise_covar(shape, *params).diag()\r\n        return 0.5 * (diag / noise_diag).sum()\r\n```\r\nThis is the current code for InducingPointKernelAddedLossTerm.loss\r\n\r\nFrom what I see, this \"loss term\" is added into the mll that is returned by the `ExactMarginalLogLikelihood` class. This in itself is misleading as the loss is usually the negative of the mll.\r\n\r\nMoreover, the variational negative loss used to evaluate inducing points is given below\r\n\r\n![image](https://user-images.githubusercontent.com/4582526/122106510-4c545980-ce1a-11eb-9bbc-681bea511bec.png)\r\n\r\nAs can be seen, the above is the expression for the pseudo-mll that is maximized when optimizing the inducing points. in this, the component of `InducingPointKernelAddedLossTerm` is negative to the value that is being added into the loss.\r\n\r\nThis is quite likely a significant bug. Please fix (just invert the sign of `diag` above)\r\n\n", "before_files": [{"content": "#!/usr/bin/env python3\n\nfrom .added_loss_term import AddedLossTerm\n\n\nclass InducingPointKernelAddedLossTerm(AddedLossTerm):\n    def __init__(self, variational_dist, prior_dist, likelihood):\n        self.prior_dist = prior_dist\n        self.variational_dist = variational_dist\n        self.likelihood = likelihood\n\n    def loss(self, *params):\n        prior_covar = self.prior_dist.lazy_covariance_matrix\n        variational_covar = self.variational_dist.lazy_covariance_matrix\n        diag = prior_covar.diag() - variational_covar.diag()\n        shape = prior_covar.shape[:-1]\n        noise_diag = self.likelihood._shaped_noise_covar(shape, *params).diag()\n        return 0.5 * (diag / noise_diag).sum()\n", "path": "gpytorch/mlls/inducing_point_kernel_added_loss_term.py"}]}