gpytorch/variational/_variational_strategy.py
Killed 29 out of 50 mutantsSurvived
Survived mutation testing. These mutants show holes in your test suite.Mutant 184
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -16,7 +16,7 @@
Abstract base class for all Variational Strategies.
"""
- def __init__(self, model, inducing_points, variational_distribution, learn_inducing_locations=True):
+ def __init__(self, model, inducing_points, variational_distribution, learn_inducing_locations=False):
super().__init__()
# Model
Mutant 189
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -25,7 +25,7 @@
# Inducing points
inducing_points = inducing_points.clone()
if inducing_points.dim() == 1:
- inducing_points = inducing_points.unsqueeze(-1)
+ inducing_points = inducing_points.unsqueeze(+1)
if learn_inducing_locations:
self.register_parameter(name="inducing_points", parameter=torch.nn.Parameter(inducing_points))
else:
Mutant 196
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -33,7 +33,7 @@
# Variational distribution
self._variational_distribution = variational_distribution
- self.register_buffer("variational_params_initialized", torch.tensor(0))
+ self.register_buffer("variational_params_initialized", torch.tensor(1))
def _expand_inputs(self, x, inducing_points):
"""
Mutant 198
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -39,7 +39,7 @@
"""
Pre-processing step in __call__ to make x the same batch_shape as the inducing points
"""
- batch_shape = _mul_broadcast_shape(inducing_points.shape[:-2], x.shape[:-2])
+ batch_shape = _mul_broadcast_shape(inducing_points.shape[:-3], x.shape[:-2])
inducing_points = inducing_points.expand(*batch_shape, *inducing_points.shape[-2:])
x = x.expand(*batch_shape, *x.shape[-2:])
return x, inducing_points
Mutant 203
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -40,7 +40,7 @@
Pre-processing step in __call__ to make x the same batch_shape as the inducing points
"""
batch_shape = _mul_broadcast_shape(inducing_points.shape[:-2], x.shape[:-2])
- inducing_points = inducing_points.expand(*batch_shape, *inducing_points.shape[-2:])
+ inducing_points = inducing_points.expand(*batch_shape, *inducing_points.shape[-3:])
x = x.expand(*batch_shape, *x.shape[-2:])
return x, inducing_points
Mutant 208
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -44,7 +44,6 @@
x = x.expand(*batch_shape, *x.shape[-2:])
return x, inducing_points
- @abstractproperty
@cached(name="prior_distribution_memo")
def prior_distribution(self):
r"""
Mutant 209
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -45,7 +45,7 @@
return x, inducing_points
@abstractproperty
- @cached(name="prior_distribution_memo")
+ @cached(name="XXprior_distribution_memoXX")
def prior_distribution(self):
r"""
The :func:`~gpytorch.variational.VariationalStrategy.prior_distribution` method determines how to compute the
Mutant 210
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -45,7 +45,7 @@
return x, inducing_points
@abstractproperty
- @cached(name="prior_distribution_memo")
+
def prior_distribution(self):
r"""
The :func:`~gpytorch.variational.VariationalStrategy.prior_distribution` method determines how to compute the
Mutant 212
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -58,7 +58,7 @@
raise NotImplementedError
@property
- @cached(name="variational_distribution_memo")
+ @cached(name="XXvariational_distribution_memoXX")
def variational_distribution(self):
return self._variational_distribution()
Mutant 213
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -58,7 +58,7 @@
raise NotImplementedError
@property
- @cached(name="variational_distribution_memo")
+
def variational_distribution(self):
return self._variational_distribution()
Mutant 214
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -90,7 +90,7 @@
:rtype: torch.Tensor
"""
- with settings.max_preconditioner_size(0):
+ with settings.max_preconditioner_size(1):
kl_divergence = torch.distributions.kl.kl_divergence(self.variational_distribution, self.prior_distribution)
return kl_divergence
Mutant 216
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -94,7 +94,7 @@
kl_divergence = torch.distributions.kl.kl_divergence(self.variational_distribution, self.prior_distribution)
return kl_divergence
- def train(self, mode=True):
+ def train(self, mode=False):
# Make sure we are clearing the cache if we change modes
if (self.training and not mode) or mode:
clear_cache_hook(self)
Mutant 217
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -96,7 +96,7 @@
def train(self, mode=True):
# Make sure we are clearing the cache if we change modes
- if (self.training and not mode) or mode:
+ if (self.training and mode) or mode:
clear_cache_hook(self)
return super().train(mode=mode)
Mutant 218
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -96,7 +96,7 @@
def train(self, mode=True):
# Make sure we are clearing the cache if we change modes
- if (self.training and not mode) or mode:
+ if (self.training or not mode) or mode:
clear_cache_hook(self)
return super().train(mode=mode)
Mutant 219
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -96,7 +96,7 @@
def train(self, mode=True):
# Make sure we are clearing the cache if we change modes
- if (self.training and not mode) or mode:
+ if (self.training and not mode) and mode:
clear_cache_hook(self)
return super().train(mode=mode)
Mutant 221
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -100,7 +100,7 @@
clear_cache_hook(self)
return super().train(mode=mode)
- def __call__(self, x, prior=False):
+ def __call__(self, x, prior=True):
# If we're in prior mode, then we're done!
if prior:
return self.model.forward(x)
Mutant 223
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -109,7 +109,7 @@
if self.training:
clear_cache_hook(self)
# (Maybe) initialize variational distribution
- if not self.variational_params_initialized.item():
+ if self.variational_params_initialized.item():
prior_dist = self.prior_distribution
self._variational_distribution.initialize_variational_distribution(prior_dist)
self.variational_params_initialized.fill_(1)
Mutant 225
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -112,7 +112,7 @@
if not self.variational_params_initialized.item():
prior_dist = self.prior_distribution
self._variational_distribution.initialize_variational_distribution(prior_dist)
- self.variational_params_initialized.fill_(1)
+ self.variational_params_initialized.fill_(2)
# Ensure inducing_points and x are the same size
inducing_points = self.inducing_points
Mutant 227
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -116,7 +116,7 @@
# Ensure inducing_points and x are the same size
inducing_points = self.inducing_points
- if inducing_points.shape[:-2] != x.shape[:-2]:
+ if inducing_points.shape[:+2] != x.shape[:-2]:
x, inducing_points = self._expand_inputs(x, inducing_points)
# Get p(u)/q(u)
Mutant 228
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -116,7 +116,7 @@
# Ensure inducing_points and x are the same size
inducing_points = self.inducing_points
- if inducing_points.shape[:-2] != x.shape[:-2]:
+ if inducing_points.shape[:-3] != x.shape[:-2]:
x, inducing_points = self._expand_inputs(x, inducing_points)
# Get p(u)/q(u)
Mutant 230
--- gpytorch/variational/_variational_strategy.py
+++ gpytorch/variational/_variational_strategy.py
@@ -116,7 +116,7 @@
# Ensure inducing_points and x are the same size
inducing_points = self.inducing_points
- if inducing_points.shape[:-2] != x.shape[:-2]:
+ if inducing_points.shape[:-2] != x.shape[:+2]:
x, inducing_points = self._expand_inputs(x, inducing_points)
# Get p(u)/q(u)