Register constant_folding during gpu opt.

This give a small speed up.
small speed up
replace numpy.all/any to all/any, faster.

also a few pep8, as we support python 2.6+ now this is valid.