Open PietropaoloFrisoni opened 4 days ago
Thanks for the issue, should be quite easy to get a quick fix out for.
I suppose logically there is some difference between calling dtype
here for a general TN and MPS circuit.
Probably the best thing would be a dtype="auto"
argument to the Circuit constructors, which can be overridden in specific methods. It would apply to the whole MPS simulation, but by default only to the contraction of full TN simulation. Would that cover your use cases?
Thanks for the issue, should be quite easy to get a quick fix out for.
That's great, thanks for the quick response.
I suppose logically there is some difference between calling
dtype
here for a general TN and MPS circuit.
- In the TN case, the dtype is just specifying what dtype to perform the actual contraction with, after the whole circuit has been constructed and simplified.
- In the MPS case, the circuit has already been mostly 'contracted' eagerly as the gates have been supplied, so changing the dtype here just affects the last bit of computation / will not have that much affect / makes less sense.
Yes, I agree.
Probably the best thing would be a
dtype="auto"
argument to the Circuit constructors, which can be overridden in specific methods. It would apply to the whole MPS simulation, but by default only to the contraction of full TN simulation.
Seems reasonable.
Would that cover your use cases?
Yes, I think so. We probably wouldn't even need to override the dtype
argument in PennyLane (at least at the current stage) for specific methods; we could just set the dtype
parameter in the constructor and the MPS_computational_state
method (and potentially local_expectation
). But in the near future we could benefit from greater flexibility in overriding parameters, so every additional feature you want to add is greatly appreciated 🚀
Thank you!
local_expectation
for MPS quantum circuits no longer works ifdtype
is specified.Good morning/afternoon/evening, Mr. Gray, I hope you are doing well.
Last week, just after the release of
quimb 1.9.0
, we had some failures in our PennyLane test suite regarding theDefaultTensor
device, which is based onquimb
.It seems to me that all the errors depend on the fact that providing
dtype
to thelocal_expectation
method for theCircuitMPS
class no longer seems to work. This is probably related to the fact thatCircuitMPS.local_expectation
has been specialized to make use of the MPS form in version 1.9.0.The following is a minimal example to reproduce the error:
With version 1.9.0, it fails with the following
TypeError
:On the other hand, the standard non-MPS circuit still works as expected, since
correctly produces:
We temporarily pinned
quimb
to the previous version in the latest version of PennyLane to avoid failures. If this is a bug in the new version ofquimb
, how hard would it be to fix it? Otherwise, do you recommend changing the approach to specify thedtype
in the computation of local expectation values in the newquimb
version?As always, thank you so much for your help. All the best.