Skip to content

Commit c5f40d4

Browse files
andrijapauactions-userjosephbowlesrashidnhmdoctorperceptron
authored
merge dev into master for v0.42.0 release (#1442)
Following the release guide, > Create a new branch from dev, and open a PR to merge the new branch into master. Once merged in, ensure that master subsequently builds successfully. This merges all changes from `dev` that occured for the release of `v0.42.0` PL ecosystem. PR is a follow up to #1441 where we updated dependencies in `dev`. This PR was created with, - Make branch `final-dev-v0420` after pulling latest `dev` - Create PR targeting master --------- Co-authored-by: GitHub Nightly Merge Action <actions@github.com> Co-authored-by: josephbowles <54283511+josephbowles@users.noreply.github.com> Co-authored-by: Rashid N H M <95639609+rashidnhm@users.noreply.github.com> Co-authored-by: Paul Finlay <50180049+doctorperceptron@users.noreply.github.com> Co-authored-by: doctorperceptron <paul@xanadu.ai> Co-authored-by: dwierichs <david.wierichs@xanadu.ai> Co-authored-by: JerryChen97 <chenys13@outlook.com> Co-authored-by: Alan Martin <53958929+Alan-eMartin@users.noreply.github.com> Co-authored-by: Mudit Pandey <18223836+mudit2812@users.noreply.github.com> Co-authored-by: Astral Cai <astral.cai@xanadu.ai> Co-authored-by: Luis Alfredo Nuñez Meneses <alfredo.nunez@xanadu.ai>
1 parent 95527ba commit c5f40d4

File tree

90 files changed

+2315
-2444
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+2315
-2444
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ download:
6262
wget --no-verbose -N https://download.pytorch.org/tutorial/hymenoptera_data.zip -P $(DATADIR)
6363
unzip -q -o $(DATADIR)/hymenoptera_data.zip -d $(DATADIR)/
6464

65+
# TODO: Update flax, or certain tutorials e.g. tutorial_rl_pulse.py will fail due to implicit confliction between jax==0.6.0 and flax==0.9.0
6566
environment:
6667
@command -v $(POETRY_BIN) --version >/dev/null 2>&1 || { echo >&2 "Setting up the environment requires a valid installation of python-poetry. Please install and add poetry to PATH or pass the executable using POETRY_BIN. Aborting."; exit 1; }
6768
@if [ '$(BASE_ONLY)' = 'true' ]; then\

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,10 @@ Due to the large scope of requirements in this repository, the traditional `requ
165165
and `pyproject.toml` is being introduced instead, the goal being easier management in regard to adding/updating packages.
166166

167167
To install all the dependencies locally, [poetry](https://python-poetry.org/) needs to be installed. Please follow the
168-
[official installation documentation](https://python-poetry.org/docs/#installation).
168+
[official installation documentation](https://python-poetry.org/docs/#installation). To ensure that no issues arise, we
169+
recommend using the [official installer](https://python-poetry.org/docs/#installing-with-the-official-installer).
170+
171+
**IMPORTANT NOTE:** It is important to install Poetry using the official instructions and NOT into the same virtual env as QML itself, this would cause poetry to manage itself and raise unexpected errors.
169172

170173
### Installing dependencies
171174

Loading
Loading

_static/demonstration_assets/quantum_volume/lima.svg

Lines changed: 0 additions & 233 deletions
This file was deleted.

conf.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@
1818
import numpy as np
1919
from jinja2 import FileSystemLoader, Environment
2020
import yaml
21-
from pennylane import PennyLaneDeprecationWarning
2221
from pathlib import Path
2322

2423
sys.path.insert(0, os.path.abspath("."))
2524
sys.path.insert(0, os.path.join(os.path.dirname(__file__)))
2625

26+
# This module has been refactored from pennylane v0.41.0 to v0.42.0
27+
# This can be removed after the release of v0.42.0
28+
try:
29+
from pennylane.exceptions import PennyLaneDeprecationWarning
30+
except ModuleNotFoundError:
31+
from pennylane import PennyLaneDeprecationWarning
2732

2833
# -- Project information -----------------------------------------------------
2934
# General information about the project.

demonstrations/adjoint_diff_benchmarking.metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
}
77
],
88
"dateOfPublication": "2021-11-23T00:00:00+00:00",
9-
"dateOfLastModification": "2024-10-07T00:00:00+00:00",
9+
"dateOfLastModification": "2025-07-11T00:00:00+00:00",
1010
"categories": [
1111
"Getting Started"
1212
],

demonstrations/adjoint_diff_benchmarking.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,20 @@
2222
import timeit
2323
import matplotlib.pyplot as plt
2424
import pennylane as qml
25-
import jax
26-
27-
jax.config.update("jax_platform_name", "cpu")
28-
jax.config.update('jax_enable_x64', True)
25+
import pennylane.numpy as pnp
2926

3027
plt.style.use("bmh")
3128

3229
n_samples = 5
3330

3431

3532
def get_time(qnode, params):
36-
globals_dict = {'grad': jax.grad, 'circuit': qnode, 'params': params}
33+
globals_dict = {"grad": qml.grad, "circuit": qnode, "params": params}
3734
return timeit.timeit("grad(circuit)(params)", globals=globals_dict, number=n_samples)
3835

3936

4037
def wires_scaling(n_wires, n_layers):
41-
key = jax.random.PRNGKey(42)
38+
rng = pnp.random.default_rng(12345)
4239

4340
t_adjoint = []
4441
t_ps = []
@@ -58,7 +55,7 @@ def circuit(params, wires):
5855

5956
# set up the parameters
6057
param_shape = qml.StronglyEntanglingLayers.shape(n_wires=i_wires, n_layers=n_layers)
61-
params = jax.random.normal(key, param_shape)
58+
params = rng.normal(size=pnp.prod(param_shape), requires_grad=True).reshape(param_shape)
6259

6360
t_adjoint.append(get_time(circuit_adjoint, params))
6461
t_backprop.append(get_time(circuit_backprop, params))
@@ -68,10 +65,10 @@ def circuit(params, wires):
6865

6966

7067
def layers_scaling(n_wires, n_layers):
71-
key = jax.random.PRNGKey(42)
68+
rng = pnp.random.default_rng(12345)
7269

7370
dev = qml.device("lightning.qubit", wires=n_wires)
74-
dev_python = qml.device('default.qubit', wires=n_wires)
71+
dev_python = qml.device("default.qubit", wires=n_wires)
7572

7673
t_adjoint = []
7774
t_ps = []
@@ -88,7 +85,7 @@ def circuit(params):
8885
for i_layers in n_layers:
8986
# set up the parameters
9087
param_shape = qml.StronglyEntanglingLayers.shape(n_wires=n_wires, n_layers=i_layers)
91-
params = jax.random.normal(key, param_shape)
88+
params = rng.normal(size=pnp.prod(param_shape), requires_grad=True).reshape(param_shape)
9289

9390
t_adjoint.append(get_time(circuit_adjoint, params))
9491
t_backprop.append(get_time(circuit_backprop, params))
@@ -110,9 +107,9 @@ def circuit(params):
110107
# Generating the graphic
111108
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 4))
112109

113-
ax1.plot(wires_list, adjoint_wires, '.-', label="adjoint")
114-
ax1.plot(wires_list, ps_wires, '.-', label="parameter-shift")
115-
ax1.plot(wires_list, backprop_wires, '.-', label="backprop")
110+
ax1.plot(wires_list, adjoint_wires, ".-", label="adjoint")
111+
ax1.plot(wires_list, ps_wires, ".-", label="parameter-shift")
112+
ax1.plot(wires_list, backprop_wires, ".-", label="backprop")
116113

117114
ax1.legend()
118115

@@ -122,16 +119,17 @@ def circuit(params):
122119
ax1.set_yscale("log")
123120
ax1.set_title("Scaling with wires")
124121

125-
ax2.plot(layers_list, adjoint_layers, '.-', label="adjoint")
126-
ax2.plot(layers_list, ps_layers, '.-', label="parameter-shift")
127-
ax2.plot(layers_list, backprop_layers, '.-', label="backprop")
122+
ax2.plot(layers_list, adjoint_layers, ".-", label="adjoint")
123+
ax2.plot(layers_list, ps_layers, ".-", label="parameter-shift")
124+
ax2.plot(layers_list, backprop_layers, ".-", label="backprop")
128125

129126
ax2.legend()
130127

131128
ax2.set_xlabel("Number of layers")
132129
ax2.set_xticks(layers_list)
133-
ax2.set_ylabel("Time")
134-
ax2.set_title("Scaling with Layers")
130+
ax2.set_ylabel("Log Time")
131+
ax2.set_yscale("log")
132+
ax2.set_title("Scaling with layers")
135133

136134
plt.savefig("scaling.png")
137135

demonstrations/ahs_aquila.metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
}
77
],
88
"dateOfPublication": "2023-05-16T00:00:00+00:00",
9-
"dateOfLastModification": "2024-10-07T00:00:00+00:00",
9+
"dateOfLastModification": "2025-07-11T00:00:00+00:00",
1010
"categories": ["Quantum Hardware", "Devices and Performance", "Quantum Computing"],
1111
"tags": [],
1212
"previewImages": [

0 commit comments

Comments
 (0)