FIX: tutorial pycuda <> theano compatilbity

thunk needs lazy attribute
Merge pull request #2119 from nouiz/warning

Warning
Merge pull request #2120 from npinto/patch-1

FIX: tutorial pycuda <> theano compatibility
pep8
Cache Scan.connection_pattern(). Hopefully, it will speed up theano.grad.
Don't pre-merge constant that aren't hashable.
Make MakeSlice.make_node accept the node inputs as parameter.

This is needed for scan optimization to rebuild the node outside the scan.
Fix _metadict to allow removing un hashable value.

_metadict is a dict that work with not hashable type. This is needed
for the SliceType.
allow debugprint() to work on list/tuple of any of the objects is support.
get_scalar_constant_value() now work over maximum and minimum
get_scalar_constant_value() now know about Rebroadcast(x,...).shape[idx].
[BUG] Scan now correctly raise error when it get negative steps or 0 steps.

fix gh-1455 by making all version raise an error. (But not always the same error).

This also fix the problem where test_rop where randomly returning some
bad answer, but making that case return an error (0 step in scan). We still need to find why the scan save mem sometimes generated scan with 0 step.
Work around a not implemented Scan case that can be introduced by opt.
Add test for the fixed crash with the opt merge of slices.
Small test change to make DebugMode error appear earlier.
Add an assert, it fail if the post_condition aren't respected: that the remove constant and not used inputs is run before the save mem scan opt.
Remove var not used and add todo comment.
Add code in comment that need to be more tested.
Fix cython new numpy interface problems.
Add some doc about scan opt.