Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The latest pennylane-cirq requires simulate method without analytic argument. #69

Closed
jaeyoo opened this issue Jul 3, 2021 · 5 comments

Comments

@jaeyoo
Copy link

jaeyoo commented Jul 3, 2021

On 0.14.0, there was analytic argument in qml.device, so we could set if False and then add Cirq-based simulators. However, the latest version has no analytic, and it always requires simulate method.

In details, when we run the colab here, if we change the pennylane & pennylane-cirq versions to the latest, then it says:

AttributeError: 'CirqSimulator' object has no attribute 'simulate'.
@josh146
Copy link
Member

josh146 commented Jul 5, 2021

Hi @jaeyoo! The latest version of PennyLane replaces the anlaytic keyword argument with shots=None. If you change to shots=None in the colab notebook, does it then work?

@jaeyoo
Copy link
Author

jaeyoo commented Jul 5, 2021

Thank you @josh146 , I realized that the issue was caused by shots=None. After assigning some value to shots the error message's gone.

For the case of shots=None (or previously analytic=True), is simulate() mandatory? I mean, For the latest Cirq simulator, we can see:

cirq.sim.SimulatesExpectationValues.simulate_expectation_values()
cirq.sim.SimulatesFinalState.simulate()

and it seems to accept SimulatesFiniteState simulator only. Is it mandatory? What about SimulatesExpectationValues simulator..?

@josh146
Copy link
Member

josh146 commented Jul 5, 2021

Glad it worked!

For the case of shots=None (or previously analytic=True), is simulate() mandatory?

I don't believe so, no; I think this is an artifact of the core of this plugin being written against an older Cirq version. If there are better ways of accessing expectation values, we should mark the plugin for an update to access these more efficient methods.

@jaeyoo
Copy link
Author

jaeyoo commented Jul 5, 2021

Thank you Josh, yes, I hope the latest PennyLane-Cirq supports the latest Cirq too. Could you please add this feature into it?

@josh146
Copy link
Member

josh146 commented Jul 5, 2021

@jaeyoo I've created a new issue here (#70), so will close this one for now 🙂 Feel free to comment on the other one in case I have missed any details!

I hope the latest PennyLane-Cirq supports the latest Cirq too

Just double checking, is anything broken using PennyLane with the latest Cirq version? Or is it more that there are newer features available?

@josh146 josh146 closed this as completed Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants