nouiz/Theano — comment on commit 77f3c94ef77757fdeb9c9ec6d886451f413d4273
File:  line 0
By nouiz:

We suported and I think should continue to support to allow compiling only some Theano function on the gpu. So we could want the default to be the cpu and have only some Theano function run on the GPU. That is the way gpu tests work. Otherwise, it will break all cpu tests...

When we import theano, if device start with gpu, we import theano.sandbox.cuda. When it load, if device start with gpu, it enable by default the gpu optimization.

If you want to enable the gpu optimization just for some theano function, you must import theano.sandbox.cuda, then tell the mode to use the gpu optimization like that:

mode_with_gpu = theano.compile.mode.get_default_mode().including('gpu')
mode_without_gpu = theano.compile.mode.get_default_mode().excluding('gpu')