Added check in order to see if 'may_share_memory' exists.
Merge pull request #1969 from AlassaneNdiaye/fix__test_cross_validation.py

Modifications in order to pass the tests in pylearn2/cross_validation/tests/test_cross_validation.py