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

Support sampling #3

Open
josh146 opened this issue Jul 29, 2019 · 0 comments
Open

Support sampling #3

josh146 opened this issue Jul 29, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@josh146
Copy link
Member

josh146 commented Jul 29, 2019

With the latest development version of PennyLane, we now support returning samples from the QNode, as well as expectation values and variance:

@qml.qnode(dev)
def circuit(x):
    qml.RX(x, wires=0)
    qml.CNOT(wires=[0, 1])
    return expval(qml.PauliZ(0)), sample(qml.PauliZ(1))

Plugins can support this new feature by subclassing the Device.sample() method, returning the requested number of samples for a given observable.

@josh146 josh146 added the enhancement New feature or request label Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant