gpytorch/models/exact_gp.py
Killed 50 out of 65 mutantsSurvived
Survived mutation testing. These mutants show holes in your test suite.Mutant 7
--- gpytorch/models/exact_gp.py
+++ gpytorch/models/exact_gp.py
@@ -53,7 +53,7 @@
"""
def __init__(self, train_inputs, train_targets, likelihood):
- if train_inputs is not None and torch.is_tensor(train_inputs):
+ if train_inputs is not None or torch.is_tensor(train_inputs):
train_inputs = (train_inputs,)
if train_inputs is not None and not all(torch.is_tensor(train_input) for train_input in train_inputs):
raise RuntimeError("Train inputs must be a tensor, or a list/tuple of tensors")
Mutant 9
--- gpytorch/models/exact_gp.py
+++ gpytorch/models/exact_gp.py
@@ -55,7 +55,7 @@
def __init__(self, train_inputs, train_targets, likelihood):
if train_inputs is not None and torch.is_tensor(train_inputs):
train_inputs = (train_inputs,)
- if train_inputs is not None and not all(torch.is_tensor(train_input) for train_input in train_inputs):
+ if train_inputs is None and not all(torch.is_tensor(train_input) for train_input in train_inputs):
raise RuntimeError("Train inputs must be a tensor, or a list/tuple of tensors")
if not isinstance(likelihood, _GaussianLikelihoodBase):
raise RuntimeError("ExactGP can only handle Gaussian likelihoods")
Mutant 14
--- gpytorch/models/exact_gp.py
+++ gpytorch/models/exact_gp.py
@@ -62,7 +62,7 @@
super(ExactGP, self).__init__()
if train_inputs is not None:
- self.train_inputs = tuple(tri.unsqueeze(-1) if tri.ndimension() == 1 else tri for tri in train_inputs)
+ self.train_inputs = tuple(tri.unsqueeze(+1) if tri.ndimension() == 1 else tri for tri in train_inputs)
self.train_targets = train_targets
else:
self.train_inputs = None
Mutant 21
--- gpytorch/models/exact_gp.py
+++ gpytorch/models/exact_gp.py
@@ -69,7 +69,7 @@
self.train_targets = None
self.likelihood = likelihood
- self.prediction_strategy = None
+ self.prediction_strategy = ""
@property
def train_targets(self):
Mutant 23
--- gpytorch/models/exact_gp.py
+++ gpytorch/models/exact_gp.py
@@ -75,7 +75,6 @@
def train_targets(self):
return self._train_targets
- @train_targets.setter
def train_targets(self, value):
object.__setattr__(self, "_train_targets", value)
Mutant 25
--- gpytorch/models/exact_gp.py
+++ gpytorch/models/exact_gp.py
@@ -95,7 +95,7 @@
self.train_targets = self.train_targets.unsqueeze(0).expand(num_samples, *self.train_targets.shape)
super().local_load_samples(samples_dict, memo, prefix)
- def set_train_data(self, inputs=None, targets=None, strict=True):
+ def set_train_data(self, inputs=None, targets=None, strict=False):
"""
Set training data (does not re-fit model hyper-parameters).
Mutant 31
--- gpytorch/models/exact_gp.py
+++ gpytorch/models/exact_gp.py
@@ -251,7 +251,7 @@
def __call__(self, *args, **kwargs):
train_inputs = list(self.train_inputs) if self.train_inputs is not None else []
- inputs = [i.unsqueeze(-1) if i.ndimension() == 1 else i for i in args]
+ inputs = [i.unsqueeze(+1) if i.ndimension() == 1 else i for i in args]
# Training mode: optimizing
if self.training:
Mutant 41
--- gpytorch/models/exact_gp.py
+++ gpytorch/models/exact_gp.py
@@ -267,7 +267,7 @@
return res
# Prior mode
- elif settings.prior_mode.on() or self.train_inputs is None or self.train_targets is None:
+ elif settings.prior_mode.on() and self.train_inputs is None or self.train_targets is None:
full_inputs = args
full_output = super(ExactGP, self).__call__(*full_inputs, **kwargs)
if settings.debug().on():
Mutant 47
--- gpytorch/models/exact_gp.py
+++ gpytorch/models/exact_gp.py
@@ -298,7 +298,7 @@
# Concatenate the input to the training input
full_inputs = []
- batch_shape = train_inputs[0].shape[:-2]
+ batch_shape = train_inputs[0].shape[:-3]
for train_input, input in zip(train_inputs, inputs):
# Make sure the batch shapes agree for training/test data
if batch_shape != train_input.shape[:-2]:
Mutant 49
--- gpytorch/models/exact_gp.py
+++ gpytorch/models/exact_gp.py
@@ -301,7 +301,7 @@
batch_shape = train_inputs[0].shape[:-2]
for train_input, input in zip(train_inputs, inputs):
# Make sure the batch shapes agree for training/test data
- if batch_shape != train_input.shape[:-2]:
+ if batch_shape == train_input.shape[:-2]:
batch_shape = _mul_broadcast_shape(batch_shape, train_input.shape[:-2])
train_input = train_input.expand(*batch_shape, *train_input.shape[-2:])
if batch_shape != input.shape[:-2]:
Mutant 50
--- gpytorch/models/exact_gp.py
+++ gpytorch/models/exact_gp.py
@@ -301,7 +301,7 @@
batch_shape = train_inputs[0].shape[:-2]
for train_input, input in zip(train_inputs, inputs):
# Make sure the batch shapes agree for training/test data
- if batch_shape != train_input.shape[:-2]:
+ if batch_shape != train_input.shape[:+2]:
batch_shape = _mul_broadcast_shape(batch_shape, train_input.shape[:-2])
train_input = train_input.expand(*batch_shape, *train_input.shape[-2:])
if batch_shape != input.shape[:-2]:
Mutant 51
--- gpytorch/models/exact_gp.py
+++ gpytorch/models/exact_gp.py
@@ -301,7 +301,7 @@
batch_shape = train_inputs[0].shape[:-2]
for train_input, input in zip(train_inputs, inputs):
# Make sure the batch shapes agree for training/test data
- if batch_shape != train_input.shape[:-2]:
+ if batch_shape != train_input.shape[:-3]:
batch_shape = _mul_broadcast_shape(batch_shape, train_input.shape[:-2])
train_input = train_input.expand(*batch_shape, *train_input.shape[-2:])
if batch_shape != input.shape[:-2]:
Mutant 52
--- gpytorch/models/exact_gp.py
+++ gpytorch/models/exact_gp.py
@@ -304,7 +304,7 @@
if batch_shape != train_input.shape[:-2]:
batch_shape = _mul_broadcast_shape(batch_shape, train_input.shape[:-2])
train_input = train_input.expand(*batch_shape, *train_input.shape[-2:])
- if batch_shape != input.shape[:-2]:
+ if batch_shape == input.shape[:-2]:
batch_shape = _mul_broadcast_shape(batch_shape, input.shape[:-2])
train_input = train_input.expand(*batch_shape, *train_input.shape[-2:])
input = input.expand(*batch_shape, *input.shape[-2:])
Mutant 53
--- gpytorch/models/exact_gp.py
+++ gpytorch/models/exact_gp.py
@@ -304,7 +304,7 @@
if batch_shape != train_input.shape[:-2]:
batch_shape = _mul_broadcast_shape(batch_shape, train_input.shape[:-2])
train_input = train_input.expand(*batch_shape, *train_input.shape[-2:])
- if batch_shape != input.shape[:-2]:
+ if batch_shape != input.shape[:+2]:
batch_shape = _mul_broadcast_shape(batch_shape, input.shape[:-2])
train_input = train_input.expand(*batch_shape, *train_input.shape[-2:])
input = input.expand(*batch_shape, *input.shape[-2:])
Mutant 54
--- gpytorch/models/exact_gp.py
+++ gpytorch/models/exact_gp.py
@@ -304,7 +304,7 @@
if batch_shape != train_input.shape[:-2]:
batch_shape = _mul_broadcast_shape(batch_shape, train_input.shape[:-2])
train_input = train_input.expand(*batch_shape, *train_input.shape[-2:])
- if batch_shape != input.shape[:-2]:
+ if batch_shape != input.shape[:-3]:
batch_shape = _mul_broadcast_shape(batch_shape, input.shape[:-2])
train_input = train_input.expand(*batch_shape, *train_input.shape[-2:])
input = input.expand(*batch_shape, *input.shape[-2:])