gpytorch/models/exact_prediction_strategies.py

Killed 54 out of 88 mutants

Survived

Survived mutation testing. These mutants show holes in your test suite.

Mutant 1

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -25,7 +25,7 @@
 
 
 def prediction_strategy(train_inputs, train_prior_dist, train_labels, likelihood):
-    train_train_covar = train_prior_dist.lazy_covariance_matrix
+    train_train_covar = None
     if isinstance(train_train_covar, LazyEvaluatedKernelTensor):
         cls = train_train_covar.kernel.prediction_strategy
     else:

Mutant 7

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -39,7 +39,7 @@
         train_shape = train_prior_dist.event_shape
         train_labels = train_labels.view(*train_labels.shape[: -len(train_shape)], train_shape.numel())
 
-        self.train_inputs = train_inputs
+        self.train_inputs = None
         self.train_prior_dist = train_prior_dist
         self.train_labels = train_labels
         self.likelihood = likelihood

Mutant 11

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -43,7 +43,7 @@
         self.train_prior_dist = train_prior_dist
         self.train_labels = train_labels
         self.likelihood = likelihood
-        self._last_test_train_covar = None
+        self._last_test_train_covar = ""
         mvn = self.likelihood(train_prior_dist, train_inputs)
         self.lik_train_train_covar = mvn.lazy_covariance_matrix
 

Mutant 20

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -268,7 +268,7 @@
         return fant_strat
 
     @property
-    @cached(name="covar_cache")
+    @cached(name="XXcovar_cacheXX")
     def covar_cache(self):
         train_train_covar = self.lik_train_train_covar
         train_train_covar_inv_root = delazify(train_train_covar.root_inv_decomposition().root)

Mutant 21

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -268,7 +268,7 @@
         return fant_strat
 
     @property
-    @cached(name="covar_cache")
+
     def covar_cache(self):
         train_train_covar = self.lik_train_train_covar
         train_train_covar_inv_root = delazify(train_train_covar.root_inv_decomposition().root)

Mutant 25

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -275,7 +275,7 @@
         return self._exact_predictive_covar_inv_quad_form_cache(train_train_covar_inv_root, self._last_test_train_covar)
 
     @property
-    @cached(name="mean_cache")
+    @cached(name="XXmean_cacheXX")
     def mean_cache(self):
         mvn = self.likelihood(self.train_prior_dist, self.train_inputs)
         train_mean, train_train_covar = mvn.loc, mvn.lazy_covariance_matrix

Mutant 26

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -275,7 +275,7 @@
         return self._exact_predictive_covar_inv_quad_form_cache(train_train_covar_inv_root, self._last_test_train_covar)
 
     @property
-    @cached(name="mean_cache")
+
     def mean_cache(self):
         mvn = self.likelihood(self.train_prior_dist, self.train_inputs)
         train_mean, train_train_covar = mvn.loc, mvn.lazy_covariance_matrix

Mutant 30

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -280,7 +280,7 @@
         mvn = self.likelihood(self.train_prior_dist, self.train_inputs)
         train_mean, train_train_covar = mvn.loc, mvn.lazy_covariance_matrix
 
-        train_labels_offset = (self.train_labels - train_mean).unsqueeze(-1)
+        train_labels_offset = (self.train_labels - train_mean).unsqueeze(+1)
         mean_cache = train_train_covar.inv_matmul(train_labels_offset).squeeze(-1)
 
         if settings.detach_test_caches.on():

Mutant 33

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -281,7 +281,7 @@
         train_mean, train_train_covar = mvn.loc, mvn.lazy_covariance_matrix
 
         train_labels_offset = (self.train_labels - train_mean).unsqueeze(-1)
-        mean_cache = train_train_covar.inv_matmul(train_labels_offset).squeeze(-1)
+        mean_cache = train_train_covar.inv_matmul(train_labels_offset).squeeze(+1)
 
         if settings.detach_test_caches.on():
             mean_cache = mean_cache.detach()

Mutant 41

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -305,7 +305,7 @@
         # Find the components of the distribution that contain test data
         test_mean = joint_mean[..., self.num_train :]
         # For efficiency - we can make things more efficient
-        if joint_covar.size(-1) <= settings.max_eager_kernel_size.value():
+        if joint_covar.size(+1) <= settings.max_eager_kernel_size.value():
             test_covar = joint_covar[..., self.num_train :, :].evaluate()
             test_test_covar = test_covar[..., self.num_train :]
             test_train_covar = test_covar[..., : self.num_train]

Mutant 42

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -305,7 +305,7 @@
         # Find the components of the distribution that contain test data
         test_mean = joint_mean[..., self.num_train :]
         # For efficiency - we can make things more efficient
-        if joint_covar.size(-1) <= settings.max_eager_kernel_size.value():
+        if joint_covar.size(-2) <= settings.max_eager_kernel_size.value():
             test_covar = joint_covar[..., self.num_train :, :].evaluate()
             test_test_covar = test_covar[..., self.num_train :]
             test_train_covar = test_covar[..., : self.num_train]

Mutant 43

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -305,7 +305,7 @@
         # Find the components of the distribution that contain test data
         test_mean = joint_mean[..., self.num_train :]
         # For efficiency - we can make things more efficient
-        if joint_covar.size(-1) <= settings.max_eager_kernel_size.value():
+        if joint_covar.size(-1) < settings.max_eager_kernel_size.value():
             test_covar = joint_covar[..., self.num_train :, :].evaluate()
             test_test_covar = test_covar[..., self.num_train :]
             test_train_covar = test_covar[..., : self.num_train]

Mutant 49

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -332,7 +332,7 @@
         # NOTE TO FUTURE SELF:
         # You **cannot* use addmv here, because test_train_covar may not actually be a non lazy tensor even for an exact
         # GP, and using addmv requires you to delazify test_train_covar, which is obviously a huge no-no!
-        res = (test_train_covar @ self.mean_cache.unsqueeze(-1)).squeeze(-1)
+        res = (test_train_covar @ self.mean_cache.unsqueeze(+1)).squeeze(-1)
         res = res + test_mean
 
         return res

Mutant 51

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -332,7 +332,7 @@
         # NOTE TO FUTURE SELF:
         # You **cannot* use addmv here, because test_train_covar may not actually be a non lazy tensor even for an exact
         # GP, and using addmv requires you to delazify test_train_covar, which is obviously a huge no-no!
-        res = (test_train_covar @ self.mean_cache.unsqueeze(-1)).squeeze(-1)
+        res = (test_train_covar @ self.mean_cache.unsqueeze(-1)).squeeze(+1)
         res = res + test_mean
 
         return res

Mutant 56

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -350,7 +350,7 @@
                                                test points
         """
         if settings.fast_pred_var.on():
-            self._last_test_train_covar = test_train_covar
+            self._last_test_train_covar = None
 
         if settings.skip_posterior_variances.on():
             return ZeroLazyTensor(*test_test_covar.size())

Mutant 59

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -365,7 +365,7 @@
                 train_train_covar = self.likelihood(dist, self.train_inputs).lazy_covariance_matrix
 
             test_train_covar = delazify(test_train_covar)
-            train_test_covar = test_train_covar.transpose(-1, -2)
+            train_test_covar = test_train_covar.transpose(+1, -2)
             covar_correction_rhs = train_train_covar.inv_matmul(train_test_covar)
             # For efficiency
             if torch.is_tensor(test_test_covar):

Mutant 65

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -370,7 +370,7 @@
             # For efficiency
             if torch.is_tensor(test_test_covar):
                 # We can use addmm in the 2d case
-                if test_test_covar.dim() == 2:
+                if test_test_covar.dim() != 2:
                     return lazify(
                         torch.addmm(test_test_covar, test_train_covar, covar_correction_rhs, beta=1, alpha=-1)
                     )

Mutant 66

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -370,7 +370,7 @@
             # For efficiency
             if torch.is_tensor(test_test_covar):
                 # We can use addmm in the 2d case
-                if test_test_covar.dim() == 2:
+                if test_test_covar.dim() == 3:
                     return lazify(
                         torch.addmm(test_test_covar, test_train_covar, covar_correction_rhs, beta=1, alpha=-1)
                     )

Mutant 67

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -372,7 +372,7 @@
                 # We can use addmm in the 2d case
                 if test_test_covar.dim() == 2:
                     return lazify(
-                        torch.addmm(test_test_covar, test_train_covar, covar_correction_rhs, beta=1, alpha=-1)
+                        torch.addmm(test_test_covar, test_train_covar, covar_correction_rhs, beta=2, alpha=-1)
                     )
                 else:
                     return lazify(test_test_covar + test_train_covar @ covar_correction_rhs.mul(-1))

Mutant 68

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -372,7 +372,7 @@
                 # We can use addmm in the 2d case
                 if test_test_covar.dim() == 2:
                     return lazify(
-                        torch.addmm(test_test_covar, test_train_covar, covar_correction_rhs, beta=1, alpha=-1)
+                        torch.addmm(test_test_covar, test_train_covar, covar_correction_rhs, beta=1, alpha=+1)
                     )
                 else:
                     return lazify(test_test_covar + test_train_covar @ covar_correction_rhs.mul(-1))

Mutant 69

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -372,7 +372,7 @@
                 # We can use addmm in the 2d case
                 if test_test_covar.dim() == 2:
                     return lazify(
-                        torch.addmm(test_test_covar, test_train_covar, covar_correction_rhs, beta=1, alpha=-1)
+                        torch.addmm(test_test_covar, test_train_covar, covar_correction_rhs, beta=1, alpha=-2)
                     )
                 else:
                     return lazify(test_test_covar + test_train_covar @ covar_correction_rhs.mul(-1))

Mutant 72

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -389,7 +389,7 @@
                 )
             )
         else:
-            return test_test_covar + MatmulLazyTensor(
+            return test_test_covar - MatmulLazyTensor(
                 covar_inv_quad_form_root, covar_inv_quad_form_root.transpose(-1, -2).mul(-1)
             )
 

Mutant 73

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -390,7 +390,7 @@
             )
         else:
             return test_test_covar + MatmulLazyTensor(
-                covar_inv_quad_form_root, covar_inv_quad_form_root.transpose(-1, -2).mul(-1)
+                covar_inv_quad_form_root, covar_inv_quad_form_root.transpose(+1, -2).mul(-1)
             )
 
 

Mutant 77

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -390,7 +390,7 @@
             )
         else:
             return test_test_covar + MatmulLazyTensor(
-                covar_inv_quad_form_root, covar_inv_quad_form_root.transpose(-1, -2).mul(-1)
+                covar_inv_quad_form_root, covar_inv_quad_form_root.transpose(-1, -2).mul(+1)
             )
 
 

Mutant 78

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -390,7 +390,7 @@
             )
         else:
             return test_test_covar + MatmulLazyTensor(
-                covar_inv_quad_form_root, covar_inv_quad_form_root.transpose(-1, -2).mul(-1)
+                covar_inv_quad_form_root, covar_inv_quad_form_root.transpose(-1, -2).mul(-2)
             )
 
 

Mutant 79

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -424,7 +424,6 @@
             "Fantasy observation updates not yet supported for models using InterpolatedLazyTensors"
         )
 
-    @property
     @cached(name="mean_cache")
     def mean_cache(self):
         train_train_covar = self.train_prior_dist.lazy_covariance_matrix

Mutant 80

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -425,7 +425,7 @@
         )
 
     @property
-    @cached(name="mean_cache")
+    @cached(name="XXmean_cacheXX")
     def mean_cache(self):
         train_train_covar = self.train_prior_dist.lazy_covariance_matrix
         train_interp_indices = train_train_covar.left_interp_indices

Mutant 81

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -425,7 +425,7 @@
         )
 
     @property
-    @cached(name="mean_cache")
+
     def mean_cache(self):
         train_train_covar = self.train_prior_dist.lazy_covariance_matrix
         train_interp_indices = train_train_covar.left_interp_indices

Mutant 82

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -449,7 +449,6 @@
         else:
             return mean_cache
 
-    @property
     @cached(name="covar_cache")
     def covar_cache(self):
         # Get inverse root

Mutant 83

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -450,7 +450,7 @@
             return mean_cache
 
     @property
-    @cached(name="covar_cache")
+    @cached(name="XXcovar_cacheXX")
     def covar_cache(self):
         # Get inverse root
         train_train_covar = self.train_prior_dist.lazy_covariance_matrix

Mutant 84

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -450,7 +450,7 @@
             return mean_cache
 
     @property
-    @cached(name="covar_cache")
+
     def covar_cache(self):
         # Get inverse root
         train_train_covar = self.train_prior_dist.lazy_covariance_matrix

Mutant 85

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -560,7 +560,7 @@
 
 
 class SumPredictionStrategy(DefaultPredictionStrategy):
-    @property
+
     def _sub_strategies(self):
         sub_strategies = []
         for lazy_tensor in self.train_prior_dist.lazy_covariance_matrix.evaluate_kernel().lazy_tensors:

Mutant 86

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -613,7 +613,6 @@
     def get_fantasy_strategy(self, inputs, targets, full_inputs, full_targets, full_output, **kwargs):
         raise NotImplementedError("Fantasy observation updates not yet supported for models using RFFs")
 
-    @property
     @cached(name="covar_cache")
     def covar_cache(self):
         lt = self.train_prior_dist.lazy_covariance_matrix

Mutant 87

--- gpytorch/models/exact_prediction_strategies.py
+++ gpytorch/models/exact_prediction_strategies.py
@@ -614,7 +614,7 @@
         raise NotImplementedError("Fantasy observation updates not yet supported for models using RFFs")
 
     @property
-    @cached(name="covar_cache")
+    @cached(name="XXcovar_cacheXX")
     def covar_cache(self):
         lt = self.train_prior_dist.lazy_covariance_matrix
         if isinstance(lt, ConstantMulLazyTensor):