Skip to content

qp.specs output on for loops is symbolic after running adjoint.lowering #2936

Description

@dime10
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    compilerPull requests that update the compilerenhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions