Hi @EMY91,
In PennyLane, we support two main models of quantum computation:
-
Discrete variables
- This is the model simulated by
'default.qubit'
, as well as the qiskit, Forest, and ProjectQ plugins. - This model supports specific operations and expectation values:
Click here for a full list of discrete operations
Click here for a full list of discrete expectation values
- This is the model simulated by
-
Continuous variables
- This is the model simulated by
'default.gaussian'
, as well as the Strawberry Fields plugin. - This model supports specific operations and expectation values:
Click here for a full list of discrete operations
Click here for a full list of discrete expectation values
- This is the model simulated by
There are several important things to note here:
-
You cannot mix continuous and discrete operations in the same QNode.
In your case, you are usingqml.Displacement
(a continuous operation) as well asqml.RY
(a discrete operation) andqml.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 useqml.RY
, but notqml.Displacement
.
I hope that helps, let me know if you have any other questions.