amazon-braket-pennylane-plugin-python icon indicating copy to clipboard operation
amazon-braket-pennylane-plugin-python copied to clipboard

Support `qml.counts` for circuits

Open yitchen-tim opened this issue 2 years ago • 0 comments

Describe the feature you'd like qml.counts is already supported for AHS programs. There is a great value in making qml.counts available for circuits.

How would this feature be used? Please describe.

@qml.qnode(dev)
def test_circ():
    qml.PauliZ(0)
    return qml.counts()

returning measurement counts.

Describe alternatives you've considered Today, users has to change their circuit to use a Braket supported return type such as qml.expval(qml.PauliZ(0))

@qml.qnode(dev)
def test_circ():
    qml.PauliZ(0)
    return qml.expval(qml.PauliZ(0))

and then do

test_circ.device.task.result().measurement_counts

Users could not use the same circuit to first test on a pennylane simulator before running on a Braket QPU. Also, users do not want to know qml.expval(qml.PauliZ(0)), they just use it to get the circuit to run, so that they can get the measurement_counts stored in the plugin device. Furthermore, when using batch_execute, test_circ.device.task is empty. Users need to go to console and find the results of the tasks they submitted.

yitchen-tim avatar Aug 21 '23 13:08 yitchen-tim