It looks like you are missing the QNode decorator β this converts your python function circuit into a quantum function, that executes on a quantum device
For example:
# create a quantum device
dev = qml.device("default.qubit", wires=4)
# turn circuit into a QNode that runs on device
@qml.qnode(dev)
def circuit(x):
qml.templates.MottonenStatePreparation(x, wires=[1, 2, 3])
qml.Hadamard(wires=0)
return qml.expval(qml.PauliZ(0))
Many thanks, Maria. youβre the one who encouraged me to love quantum machine learning and generally speaking quantum computing. I am learning a lot from you and your team.