def METHOD_NAME(img, params):
    count = 0
    for i in range(nwires - 1):
        qai.RX(img[i] * np.pi, qubits=[i])
    for j in range(nlayer):
        for i in range(nwires - 1):
            qai.CNOT(qubits=[i, nwires - 1])
            qai.RZ(params[count], qubits=[nwires - 1])
            count += 1
            qai.CNOT(qubits=[i, nwires - 1])
        for i in range(nwires):
            qai.RX(params[count], qubits=[i])
            count += 1
    return qai.expval(qai.PauliZ(qubits=[nwires - 1]))