Skip to content
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

Replace qml.QubitDevice with qml.devices.QubitDevice #195

Merged
merged 2 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions pennylane_cirq/qsim_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"""
This module provides the ``QSimDevice`` and ``QSimhDevice`` from Cirq.
"""
import cirq
import numpy as np
import cirq
import pennylane as qml

try:
Expand Down Expand Up @@ -151,7 +151,7 @@ def capabilities(self): # pylint: disable=missing-function-docstring
return capabilities

def expval(self, observable, shot_range=None, bin_size=None):
return qml.QubitDevice.expval(self, observable, shot_range, bin_size)
return qml.devices.QubitDevice.expval(self, observable, shot_range, bin_size)

def apply(self, operations, **kwargs):
# pylint: disable=missing-function-docstring
Expand Down
4 changes: 2 additions & 2 deletions pennylane_cirq/simulator_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

----
"""
import cirq
import numpy as np
import cirq
import pennylane as qml

from .cirq_device import CirqDevice
Expand Down Expand Up @@ -266,7 +266,7 @@ def expval(self, observable, shot_range=None, bin_size=None):
try:
return super().expval(observable, shot_range, bin_size)
except ValueError:
return qml.QubitDevice.expval(self, observable, shot_range, bin_size)
return qml.devices.QubitDevice.expval(self, observable, shot_range, bin_size)

def _apply_basis_state(self, basis_state_operation):
super()._apply_basis_state(basis_state_operation)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mixed_simulator_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ def circuit():
qml.apply(gate)
return qml.expval(qml.PauliZ(0))

spy = mocker.spy(qml.QubitDevice, "expval")
spy = mocker.spy(qml.devices.QubitDevice, "expval")

if use_super:
mock_simulate = mocker.patch("cirq.DensityMatrixSimulator.simulate_expectation_values")
Expand Down
Loading