def test_correct_answer(self): a = T.matrix() b = T.matrix() x = T.tensor3() y = T.tensor3() A = numpy.cast[theano.config.floatX](numpy.random.rand(5, 3)) B = numpy.cast[theano.config.floatX](numpy.random.rand(7, 2)) X = numpy.cast[theano.config.floatX](numpy.random.rand(5, 6, 1)) Y = numpy.cast[theano.config.floatX](numpy.random.rand(1, 9, 3)) make_list((3., 4.)) c = make_list((a, b)) z = make_list((x, y)) fc = theano.function([a, b], c) fz = theano.function([x, y], z) self.assertTrue((m == n).all() for m, n in zip(fc(A, B), [A, B])) self.assertTrue((m == n).all() for m, n in zip(fz(X, Y), [X, Y]))
def correct_answer(self): a = T.matrix() b = T.matrix() x = T.tensor3() y = T.tensor3() A = numpy.random.rand(5) B = numpy.random.rand(7) X = numpy.random.rand(5, 6) Y = numpy.random.rand(1, 9) c = make_list((a, b)) z = make_list((x, y)) fc = function([a, b], c) fz = function([x, y], z) self.assertTrue(f([A, B]) == [A, B]) self.assertTrue(f([X, Y]) == [X, Y])
def test_wrong_shape(self): a = tt.vector() b = tt.matrix() with pytest.raises(TypeError): make_list((a, b))