import pennylane as qp
def fun():
@qp.for_loop(0, 10, 1)
def loop(_):
qp.S(0)
loop()
@qp.qjit(
target="mlir",
pipelines=[("short", ["builtin.module(apply-transform-sequence)"])],
)
@qp.transform(pass_name="adjoint-lowering")
@qp.qnode(qp.device("null.qubit", wires=1))
def circuit():
qp.adjoint(fun)()
return qp.probs()
print(qp.specs(circuit, level="all-mlir")())
Device: null.qubit
Device wires: 1
Shots: Shots(total=None)
Levels:
- 0: Before MLIR Passes
- 1: adjoint-lowering
↓Metric Level→ | 0 | 1
----------------------------
Wire allocations | 1 | 1
Total gates | 10 | a
Gate counts: |
- Adjoint(S) | 10 | a
Measurements: |
- probs(all wires) | 1 | 1