Infrastructure for training nets in theano