F.3.1 Error in QFT

Can anyone point out what is the issue with the circuit for F.3.1? I’m confused why this isn’t working.

dev = qml.device("default.qubit", wires=3)
def three_qubit_QFT(basis_id):
    # Prepare the basis state |basis_id>
    bits = [int(x) for x in np.binary_repr(basis_id, width=dev.num_wires)]
    qml.BasisStatePreparation(bits, wires=[0, 1, 2])

    #R_2 = S gate and R_3 = T gate
    qml.ctrl(qml.S(wires=0), control=1)
    qml.ctrl(qml.T(wires=0), control=2)
    qml.ctrl(qml.S(wires=1), control=2)

    return qml.state()

Hi @Xavier_Mootoo,

This is not very obvious in the documentation for the qml.ctrl function but the parameters for the operators are not applied within the operator but instead outside. In this case the ‘wires’ argument in the S and T operators is a parameter. Hence you would apply the controlled operation as follows:
qml.ctrl(qml.S, control=1)(wires=0)

Repeating this change for the other controlled operations should result in the question being marked as correct!