Skip to content

Commit

Permalink
Merge branch 'legacy-device-facade-class' of https://github.com/Penny…
Browse files Browse the repository at this point in the history
…LaneAI/pennylane into legacy-device-facade-class
  • Loading branch information
albi3ro committed Jul 25, 2024
2 parents ebb8f44 + 9b7605a commit 30029db
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions pennylane/devices/legacy_facade.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,27 +337,21 @@ def _update_original_device(self, temp_device):
self._device._state = temp_device._state

def _validate_backprop_method(self, tape):
print("in _valdiate_backprop_method")
if tape.shots:
print("has shots")
return False
params = tape.get_parameters(trainable_only=False)
interface = qml.math.get_interface(*params)

if tape and any(isinstance(m.obs, qml.SparseHamiltonian) for m in tape.measurements):
print("sparse hamiltonian")
return False
if interface == "numpy":
interface = None
mapped_interface = qml.workflow.execution.INTERFACE_MAP.get(interface, interface)

# determine if the device supports backpropagation
backprop_interface = self._device.capabilities().get("passthru_interface", None)
print("im here")
if backprop_interface is not None:
# device supports backpropagation natively
print("backprop_interface", backprop_interface)
print("mapped_interface: ", mapped_interface)
return mapped_interface in [backprop_interface, "Numpy"]
# determine if the device has any child devices that support backpropagation
backprop_devices = self._device.capabilities().get("passthru_devices", None)
Expand Down

0 comments on commit 30029db

Please sign in to comment.