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] validate device wires #6180

Open
1 task done
Canoming opened this issue Aug 29, 2024 · 1 comment
Open
1 task done

[BUG] validate device wires #6180

Canoming opened this issue Aug 29, 2024 · 1 comment
Labels
bug 🐛 Something isn't working

Comments

@Canoming
Copy link

Expected behavior

The default_qubit device should work with alternating regular gates and QAOA layers

Actual behavior

When the circuit includes both regular gates and QAOA layers, the wires of the layers may be converted to a tensor. This will fail the validate_device_wires method in the runtime check. set(wires) in validate_device_wires cannot convert it to a set.

Additional information

No response

Source code

n_nires = 4
dev = qml.device('default.qubit',wires = n_wires)
@qml.qnode(dev)
def circuit(params):
    for i in range(n_wires):
        qml.Hadamard(wires=i)
    for j in range(depth): 
        qaoa.cost_layer(params[j][0],cost_h)
        qaoa.mixer_layer(params[j][1],mixer_h)
    return qml.expval(cost_h)

# It raises error if the `circuit` is called

Tracebacks

No response

System information

Cannot run circuit(s) on default.qubit as they contain wires not found on the device: {0, 1, 2, 3}

Existing GitHub issues

  • I have searched existing GitHub issues to make sure the issue does not already exist.
@Canoming Canoming added the bug 🐛 Something isn't working label Aug 29, 2024
@albi3ro
Copy link
Contributor

albi3ro commented Aug 29, 2024

Thanks for opening this issue @Canoming . Mind posting the code for cost_h and mixer_h so we replicate the issue?

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

No branches or pull requests

2 participants