Skip to content

Commit

Permalink
solve issue with reset
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisAlfredoNu committed Sep 16, 2024
1 parent 87778d6 commit c493d47
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pennylane_lightning/core/lightning_newAPI_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def __init__( # pylint: disable=too-many-arguments

self._c_dtype = c_dtype
self._batch_obs = batch_obs
self._sync = None

if isinstance(wires, int):
self._wire_map = None # should just use wires as is
Expand Down Expand Up @@ -133,7 +134,7 @@ def jacobian(
"""
if wire_map is not None:
[circuit], _ = qml.map_wires(circuit, wire_map)
state.reset_state()
state.reset_state(self._sync)
final_state = state.get_final_state(circuit)
return self.LightningAdjointJacobian(final_state, batch_obs=batch_obs).calculate_jacobian(
circuit
Expand Down Expand Up @@ -191,7 +192,7 @@ def vjp( # pylint: disable=too-many-arguments
"""
if wire_map is not None:
[circuit], _ = qml.map_wires(circuit, wire_map)
state.reset_state()
state.reset_state(self._sync)
final_state = state.get_final_state(circuit)
return self.LightningAdjointJacobian(final_state, batch_obs=batch_obs).calculate_vjp(
circuit, cotangents
Expand Down

0 comments on commit c493d47

Please sign in to comment.