Skip to content

[BUG] Graph decomposition raises extraneous warnings #8885

@dime10

Description

@dime10

Problem description

When the graph decomposition cannot generate a solution to the given gate set, it raises a warning. This is sensible, however it will raise additional warnings for gates that the user hasn't even specified. In the provided example, a total of five warnings are raised:

"... unable to find a decomposition for {'Hadamard'} ..."
"Falling back to the legacy decomposition system."
"Operator RZ does not define a decomposition ..."
"Operator RX does not define a decomposition ..."
"Operator RZ does not define a decomposition ..."

The first two seem sensible while the latter three seem excessive since they pertain to operations within the graph (neither entry nor exit nodes), for which the user has no context.

Source code

from functools import partial

import pennylane as qml

qml.capture.enable()
qml.decomposition.enable_graph()

@qml.qjit
@partial(qml.transforms.decompose, gate_set={qml.GlobalPhase})
@qml.qnode(qml.device("lightning.qubit", wires=2))
def circuit(x):
    qml.Hadamard(x)
    return qml.state()

circuit(0)

Taken from https://github.com/PennyLaneAI/catalyst/blame/6a19ecf7f23c0f3f22bd5e43a0783394bf9d285d/frontend/test/pytest/from_plxpr/test_decompose_transform.py#L54

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions