Z = tf.placeholder("float64")
X_data = self.rng.randn(10, 1)
Z_data = self.rng.randn(12, 1)
for k in [self.rbf, self.lin, self.k]:
with k.tf_mode():
k._K = sess.run(
k.K(X),
After Change
Z_data = self.rng.randn(12, 1)
res = []
for k in self.kernels:
k.compile()
res.append(k.session.run(k.K(X, Z), feed_dict={X: X_data, Z: Z_data}))
self.assertTrue(np.allclose(res[0] + res[1], res[2]))