with self.test_context():
m = gpflow.models.VGP(self.X, self.Y, self.kern,
likelihood=gpflow.likelihoods.StudentT())
m.compile()
m.X = self.rng.randn(*self.X.shape)
self.assertFalse(
m._needs_recompile,
msg="Recompilation should be avoided for the same shape data")
After Change
Ynew = np.sin(Xnew) + 0.9 * np.cos(Xnew * 1.6) + rng.randn(*Xnew.shape)
with self.assertRaises(gpflow.GPflowError):
m.X = Xnew
with self.assertRaises(gpflow.GPflowError):
m.Y = Ynew
if __name__ == "__main__":
unittest.main()