hybridlane.devices.preprocess¶
Functions¶
|
Circuit pass that validates a wire is only used as a qubit or a qumode |
|
Module Contents¶
- hybridlane.devices.preprocess.static_analyze_tape(tape, fill_missing=None)[source]¶
Circuit pass that validates a wire is only used as a qubit or a qumode
This validates that once a wire is used in an operation as a qubit or a qumode, that its role remains the same in the rest of the circuit. This is physically motivated since a device cannot perform swap gates between qubits and qumodes (there would be truncation issues).
Example
# This would throw an error def bad_circuit(): qml.Displacement(alpha, 0, wires=[0]) qml.X(1) qml.H(0) # error: wire 0 became a qumode earlier during Displacement
- Parameters:
tape (QuantumScript) – The quantum circuit to check
fill_missing (str | None) – An optional string of
("qubits", "qumodes")specifying what default to provide for unidentified wires
- Raises:
if its type cannot be inferred and no default is provided. –
- Return type:
tuple[pennylane.tape.QuantumScriptBatch, pennylane.typing.PostprocessingFn]