Skip to content

Commit

Permalink
Merge branch 'master' into deprecate-qinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
mudit2812 authored Sep 13, 2024
2 parents d1d5c88 + 060bb9a commit b9e30a8
Show file tree
Hide file tree
Showing 66 changed files with 649 additions and 10,719 deletions.
6 changes: 6 additions & 0 deletions doc/development/deprecations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ Pending deprecations
- Deprecated in v0.39
- Will be removed in v0.40

* `QNode.gradient_fn` is deprecated. Please use `QNode.diff_method` instead. `QNode.get_gradient_fn` can also be used to
process the diff method.

- Deprecated in v0.39
- Will be removed in v0.40

* All of the legacy devices (any with the name ``default.qubit.{autograd,torch,tf,jax,legacy}``) are deprecated. Use ``default.qubit`` instead,
as it supports backpropagation for the many backends the legacy devices support.

Expand Down
2 changes: 1 addition & 1 deletion doc/development/guide/logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ process, and surrounding operations:
# Get logger for use by this script only.
logger = logging.getLogger(__name__)
dev_name = "default.qubit.jax"
dev_name = "default.qubit"
num_wires = 2
num_shots = None
Expand Down
2 changes: 2 additions & 0 deletions doc/development/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ This page contains the release notes for PennyLane.

.. mdinclude:: ../releases/changelog-dev.md

.. mdinclude:: ../releases/changelog-0.38.1.md

.. mdinclude:: ../releases/changelog-0.38.0.md

.. mdinclude:: ../releases/changelog-0.37.0.md
Expand Down
8 changes: 4 additions & 4 deletions doc/introduction/interfaces/jax.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ a JAX-capable QNode in PennyLane. Simply specify the ``interface='jax'`` keyword

.. code-block:: python
dev = qml.device('default.qubit.jax', wires=2)
dev = qml.device('default.qubit', wires=2)
@qml.qnode(dev, interface='jax')
def circuit1(phi, theta):
Expand Down Expand Up @@ -85,7 +85,7 @@ For example:

.. code-block:: python
dev = qml.device('default.qubit.jax', wires=2)
dev = qml.device('default.qubit', wires=2)
@qml.qnode(dev, interface='jax')
def circuit3(phi, theta):
Expand Down Expand Up @@ -119,7 +119,7 @@ the ``@jax.jit`` decorator can be directly applied to the QNode.

.. code-block:: python
dev = qml.device('default.qubit.jax', wires=2)
dev = qml.device('default.qubit', wires=2)
@jax.jit # QNode calls will now be jitted, and should run faster.
@qml.qnode(dev, interface='jax')
Expand Down Expand Up @@ -176,7 +176,7 @@ Example:
# Device construction should happen inside a `jax.jit` decorated
# method when using a PRNGKey.
dev = qml.device('default.qubit.jax', wires=2, prng_key=key, shots=100)
dev = qml.device('default.qubit', wires=2, prng_key=key, shots=100)
@qml.qnode(dev, interface='jax', diff_method=None)
Expand Down
2 changes: 1 addition & 1 deletion doc/releases/changelog-0.38.0.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
:orphan:

# Release 0.38.0 (current release)
# Release 0.38.0

<h3>New features since last release</h3>

Expand Down
14 changes: 14 additions & 0 deletions doc/releases/changelog-0.38.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
:orphan:

# Release 0.38.1 (current release)

<h3>Bug fixes 🐛</h3>

* Fix float-to-complex casting in various places across PennyLane.
[(#6260)](https://github.com/PennyLaneAI/pennylane/pull/6260)

<h3>Contributors ✍️</h3>

This release contains contributions from (in alphabetical order):

Mudit Pandey
9 changes: 8 additions & 1 deletion doc/releases/changelog-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@
* Remove support for Python 3.9.
[(#6223)](https://github.com/PennyLaneAI/pennylane/pull/6223)

* `DefaultQubitTF` and `DefaultQubitTorch` are removed. Please use `default.qubit` for all interfaces.
* `DefaultQubitTF`, `DefaultQubitTorch`, and `DefaultQubitJax` are removed. Please use `default.qubit` for all interfaces.
[(#6207)](https://github.com/PennyLaneAI/pennylane/pull/6207)
[(#6208)](https://github.com/PennyLaneAI/pennylane/pull/6208)
[(#6209)](https://github.com/PennyLaneAI/pennylane/pull/6209)

* `expand_fn`, `max_expansion`, `override_shots`, and `device_batch_transform` are removed from the
signature of `qml.execute`.
Expand All @@ -89,6 +90,9 @@
* The `qml.qinfo` module has been deprecated.
[(#5911)](https://github.com/PennyLaneAI/pennylane/pull/5911)

* `QNode.gradient_fn` is deprecated. Please use `QNode.diff_method` and `QNode.get_gradient_fn` instead.
[(#6244)](https://github.com/PennyLaneAI/pennylane/pull/6244)

<h3>Documentation 📝</h3>

<h3>Bug fixes 🐛</h3>
Expand All @@ -108,6 +112,9 @@
* The ``qml.Qubitization`` template now orders the ``control`` wires first and the ``hamiltonian`` wires second, which is the expected according to other templates.
[(#6229)](https://github.com/PennyLaneAI/pennylane/pull/6229)

* The ``qml.FABLE`` template now returns the correct value when JIT is enabled.
[(#6263)](https://github.com/PennyLaneAI/pennylane/pull/6263)

* <h3>Contributors ✍️</h3>

This release contains contributions from (in alphabetical order):
Expand Down
2 changes: 1 addition & 1 deletion pennylane/_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.39.0-dev12"
__version__ = "0.39.0-dev14"
1 change: 0 additions & 1 deletion pennylane/devices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
default_qubit
default_qubit_legacy
default_qubit_jax
default_qubit_autograd
default_gaussian
default_mixed
Expand Down
10 changes: 9 additions & 1 deletion pennylane/devices/_qubit_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,11 @@ def classical_shadow(self, obs, circuit):
n_snapshots = self.shots
seed = obs.seed

with qml.workflow.set_shots(self, shots=1):
original_shots = self.shots
original_shot_vector = self._shot_vector

try:
self.shots = 1
# slow implementation but works for all devices
n_qubits = len(wires)
mapped_wires = np.array(self.map_wires(wires))
Expand Down Expand Up @@ -1139,6 +1143,10 @@ def classical_shadow(self, obs, circuit):
)

outcomes[t] = self.generate_samples()[0][mapped_wires]
finally:
self.shots = original_shots
# pylint: disable=attribute-defined-outside-init
self._shot_vector = original_shot_vector

return self._cast(self._stack([outcomes, recipes]), dtype=np.int8)

Expand Down
Loading

0 comments on commit b9e30a8

Please sign in to comment.