Closed tabasavr closed 2 years ago
Thanks for the issue, this should be quite fixable, hopefully just by adding __setstate__
and __getstate__
to PTensor
and maybe PArray
, (which customize pickling behaviour). I can try and take a look unless you want to attempt a fix yourself!
I've looked into it, overriding __setstate__
and __getstate__
in PTensor
indeed seems to fix the issue. However there is a very weird case when it can't save it after optimizing a circuit, here's an example.
Honestly I have no idea what's happening, but it looks like when not all tensors are optimized something goes wrong. And it doesn't look like it's caused by the fix. Don't really need this to work anymore, but let me know if you have any thoughts on this.
Hmm, I'll try and take a look. Looks like something weird to do with capturing locally defined functions somehow. Thanks for the PR fixing the original issue!
What happened?
Found this when tried to load a circuit with patametrized gates. Saves fine but fails to load
What did you expect to happen?
No response
Minimal Complete Verifiable Example
Relevant log output
Anything else we need to know?
No response
Environment
Python 3.9.5 quimb 1.4.0