def test_grad():
 X = T.matrix()
 y = X.sum()
 G = T.grad(y, [X])
 assert isinstance(G, list)
 G = T.grad(y, X)
 assert (not isinstance(G, list))

def test_grad ( ) : X = T . matrix ( ) y = X . sum ( ) G = T . grad ( y , [ X ] ) assert isinstance ( G , list ) G = T . grad ( y , X ) assert ( not isinstance ( G , list ) )
tests that the theano grad method returns a list if it is passed a list and a single variable if it is passed a single variable .