Skip to content

Commit

Permalink
Change Conditional.then_op usage to Conditional.base (#752)
Browse files Browse the repository at this point in the history
New work in Pennylane removed `Conditional.then_op` in favour of
`Conditional.base`. This PR updates lightning to use the new attribute.

---------

Co-authored-by: ringo-but-quantum <github-ringo-but-quantum@xanadu.ai>
  • Loading branch information
mudit2812 and ringo-but-quantum authored Jun 6, 2024
1 parent d8baf5a commit 344ae5a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@

### Bug fixes

* `lightning.qubit` and `lightning.kokkos` use `qml.ops.Conditional.base` instead of `qml.ops.Conditional.then_op`.
[(#752)](https://github.com/PennyLaneAI/pennylane-lightning/pull/752)

* Fix AVX streaming operation support with newer GCC.
[(#729)](https://github.com/PennyLaneAI/pennylane-lightning/pull/729)

Expand Down
2 changes: 1 addition & 1 deletion pennylane_lightning/core/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
Version number (major.minor.patch[-label])
"""

__version__ = "0.37.0-dev27"
__version__ = "0.37.0-dev28"
2 changes: 1 addition & 1 deletion pennylane_lightning/lightning_kokkos/lightning_kokkos.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def apply_lightning(self, operations, mid_measurements=None, postselect_mode=Non

if isinstance(ops, Conditional):
if ops.meas_val.concretize(mid_measurements):
self.apply_lightning([ops.then_op])
self.apply_lightning([ops.base])
elif isinstance(ops, MidMeasureMP):
self._apply_lightning_midmeasure(ops, mid_measurements, postselect_mode)
elif isinstance(ops, qml.ops.op_math.Controlled) and isinstance(
Expand Down
2 changes: 1 addition & 1 deletion pennylane_lightning/lightning_qubit/_state_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def _apply_lightning(

if isinstance(operation, Conditional):
if operation.meas_val.concretize(mid_measurements):
self._apply_lightning([operation.then_op])
self._apply_lightning([operation.base])
elif isinstance(operation, MidMeasureMP):
self._apply_lightning_midmeasure(
operation, mid_measurements, postselect_mode=postselect_mode
Expand Down

0 comments on commit 344ae5a

Please sign in to comment.