x = theano.tensor.dvector()
ys = [t.tf_forward(x) for t in self.transforms]
fns = [theano.function([x], y) for y in ys]
ys_theano = [f(self.x_free) for f in fns]
ys_np = [t.forward(self.x_free) for t in self.transforms]
for y1, y2 in zip(ys_theano, ys_np):
self.failUnless(np.allclose(ys_theano, ys_np))
After Change
def test_tf_np_forward(self):
make sure the np forward transforms are the same as the tensorflow ones
ys = [t.tf_forward(self.x) for t in self.transforms]
ys_tf = [self.session.run(y, feed_dict={self.x:self.x_np}) for y in ys]
ys_np = [t.forward(self.x_np) for t in self.transforms]
for y1, y2 in zip(ys_tf, ys_np):
self.failUnless(np.allclose(y1, y2))