Skip to content

[Frontend] PyTree Observables as Parameters #338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions frontend/test/pytest/bug.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import pennylane as qml
import pytest
from catalyst import qjit


def test_observable_as_parameter(backend):
"""Test to see if we can pass an observable parameter to qfunc."""

coeffs0 = [0.3, -5.1]
H0 = qml.Hamiltonian(qml.math.array(coeffs0), [qml.PauliZ(0), qml.PauliY(1)])

@qjit
def circuit(obs):
return qml.expval(obs)

circuit(H0)