Fixed MemoryDataLayer to make it work with pycaffe