This is an extra code for Theano that depend on LGPL