qml.marker¶
- marker(tape, level)[source]¶
Mark a location in a transform program for easy access with inspectability.
- Parameters:
tape (QuantumScript | QNode | CompilePipeline) – the object we want to dispatch the transform onto
level (str) – the label for the level.
Note
Invalid level names in
markerare"top","user","device", and"gradient","all", and"all-mlir", which are internally protected.@qml.marker(level="rotations-merged") @qml.transforms.merge_rotations @qml.marker(level="my_level") @qml.transforms.cancel_inverses @qml.qnode(qml.device('null.qubit')) def c(): qml.RX(0.2,0) qml.X(0) qml.X(0) qml.RX(0.2, 0) return qml.state()
>>> print(qml.draw(c, level="my_level")()) 0: ──RX(0.20)──RX(0.20)─┤ State >>> qml.specs(c, level="my_level")()['resources'].gate_types {'RX': 2} >>> print(qml.draw(c, level="rotations-merged")()) 0: ──RX(0.40)─┤ State
code/api/pennylane.marker
Download Python script
Download Notebook
View on GitHub