Skip to content

Commit

Permalink
Re-add test.
Browse files Browse the repository at this point in the history
  • Loading branch information
erick-xanadu committed Sep 19, 2023
1 parent 69ed526 commit f0dfdbb
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions frontend/test/lit/test_measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,35 @@ def counts1(x: float, y: float):

print(counts1.mlir)


# print(counts2.mlir)
# TODO: NOTE:
# The test below used to pass before the compiler driver. This is because before the compiler
# driver, "target='mlir'" would not run the verifier. Now that the verifier is run, the circuit
# below complains.
#
# This test is commented out and the expected output is also commented out using the FileCheck
# comments (COM:).
#
# COM: CHECK-LABEL: private @counts2(
try:

@qjit(target="mlir")
@qml.qnode(qml.device("lightning.qubit", wires=2, shots=1000))
def counts2(x: float, y: float):
qml.RX(x, wires=0)
# COM: CHECK: [[q1:%.+]] = "quantum.custom"({{%.+}}, {{%.+}}) {gate_name = "RY"
qml.RY(y, wires=1)
# COM: CHECK: [[q0:%.+]] = "quantum.custom"({{%.+}}, {{%.+}}) {gate_name = "RZ"
qml.RZ(0.1, wires=0)

# COM: CHECK: [[obs1:%.+]] = "quantum.namedobs"([[q1]]) {type = #quantum<named_observable PauliX>}

Check notice on line 114 in frontend/test/lit/test_measurements.py

View check run for this annotation

codefactor.io / CodeFactor

frontend/test/lit/test_measurements.py#L114

Line too long (106/100) (line-too-long)
# COM: CHECK: [[obs2:%.+]] = "quantum.namedobs"([[q0]]) {type = #quantum<named_observable Identity>}

Check notice on line 115 in frontend/test/lit/test_measurements.py

View check run for this annotation

codefactor.io / CodeFactor

frontend/test/lit/test_measurements.py#L115

Line too long (108/100) (line-too-long)
# COM: CHECK: [[obs3:%.+]] = "quantum.tensor"([[obs1]], [[obs2]])
# COM: CHECK: "quantum.counts"([[obs3]]) {{.*}}shots = 1000 : i64{{.*}} : (!quantum.obs) -> (tensor<2xf64>, tensor<2xi64>)

Check notice on line 117 in frontend/test/lit/test_measurements.py

View check run for this annotation

codefactor.io / CodeFactor

frontend/test/lit/test_measurements.py#L117

Line too long (130/100) (line-too-long)
return qml.counts(qml.PauliX(1) @ qml.Identity(0))

print(counts2.mlir)
except:

Check notice on line 121 in frontend/test/lit/test_measurements.py

View check run for this annotation

codefactor.io / CodeFactor

frontend/test/lit/test_measurements.py#L121

No exception type(s) specified (bare-except)
...


# CHECK-LABEL: private @counts3(
Expand Down

0 comments on commit f0dfdbb

Please sign in to comment.