QuantumFunctionError

Hi @EMY91,

In PennyLane, we support two main models of quantum computation:



There are several important things to note here:

  • You cannot mix continuous and discrete operations in the same QNode.
    In your case, you are using qml.Displacement (a continuous operation) as well as qml.RY (a discrete operation) and qml.expval.PauliZ (a discrete expectation)

  • If the QNode device is a continuous device, you must use only continuous operations. Likewise, if your QNode device is a discrete device, you must use only discrete operations.
    For example, default.qubit can use qml.RY, but not qml.Displacement.

I hope that helps, let me know if you have any other questions.

1 Like