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

[BUG] Counts does not work with broadcasting #3841

Closed
1 task done
rmoyard opened this issue Feb 28, 2023 · 0 comments · Fixed by #3876
Closed
1 task done

[BUG] Counts does not work with broadcasting #3841

rmoyard opened this issue Feb 28, 2023 · 0 comments · Fixed by #3876
Assignees
Labels
bug 🐛 Something isn't working

Comments

@rmoyard
Copy link
Contributor

rmoyard commented Feb 28, 2023

Expected behavior

Broadcasted parameters should work with counts.

Actual behavior

The following code returns:

Counts: {'0000011010010010100000000001000000010110000000000000000101001110100011010000000001010111001001100001': 1, '0000111100001000111010000101010001101000010001010001000110010010011000101000010001111000010001010000': 1}
Counts: {'1010011011000010100111010011101000000100001000000000001100000000110000000000100100010011000000010111': 1}

Additional information

Source code

import pennylane as qml

dev = qml.device('default.qubit', wires=2, shots=100)

@qml.qnode(dev, interface="autograd", diff_method=None)
def circuit(param):
    # These two gates represent our QML model.
    qml.RX(param, wires=0)
    qml.CNOT(wires=[0, 1])
    return qml.counts(wires=0)


counts = circuit(qml.numpy.array([1.123, 1.1]))
print(f"Counts: {counts}")
counts = circuit(qml.numpy.array([1.123]))
print(f"Counts: {counts}")

Tracebacks

No response

System information

-

Existing GitHub issues

  • I have searched existing GitHub issues to make sure the issue does not already exist.
@rmoyard rmoyard added the bug 🐛 Something isn't working label Feb 28, 2023
@timmysilv timmysilv self-assigned this Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants