Skip to content

[BUG] validate device wires #6180

@Canoming

Description

@Canoming

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions