Optimization cache by @yaoli - copy

Test copy without ipdb import. Used to run clean tests on Travis.
You should also check that the loaded graph is equivalent here.