diff --git a/lambeq/backend/pennylane.py b/lambeq/backend/pennylane.py index f4431f8c..0ec36d7a 100644 --- a/lambeq/backend/pennylane.py +++ b/lambeq/backend/pennylane.py @@ -49,7 +49,7 @@ import sympy import torch -from lambeq.backend.quantum import Scalar +from lambeq.backend.quantum import Scalar, Measure if TYPE_CHECKING: from lambeq.backend.quantum import Diagram @@ -217,6 +217,10 @@ def to_pennylane(lambeq_circuit: Diagram, probabilities=False, """ + if any(isinstance(box, Measure) for box in lambeq_circuit.boxes): + raise ValueError("Only pure circuits, or circuits with discards" + " are currently supported.") + tk_circ = lambeq_circuit.to_tk() op_list, params_list, wires_list, symbols_set = ( extract_ops_from_tk(tk_circ)