Releases: PennyLaneAI/pennylane-sf
Release 0.29.1
Release 0.29.0
Release 0.20.1
Bug fixes
- Changed
DeviceSpec
toDevice
due to a breaking change in Strawberry Fields. (#102)
Contributors
This release contains contributions from (in alphabetical order):
Theodor Isacsson
Release 0.20.0
Improvements
-
Updated how cat states are handled in the plugin. (#86)
-
Switched to the latest remote API used by Strawberry Fields. (#86)
-
Updated how the expectation value of the identity operator is computed as
qml.Identity
only takes a single wire. (#86) -
The GBS device uses
qml.probs
(instead of the identity) to mark basis state probability computations internally. (#84)
Contributors
This release contains contributions from (in alphabetical order):
Samuel Banning, Antal Száva
Release 0.19.0
Improvements
- Changed the name of
qml.Interferometer
toqml.InterferometerUnitary
due to a breaking change in PennyLane. (#77)
Contributors
This release contains contributions from (in alphabetical order):
Romain Moyard
Release 0.16.0
Release 0.15.0
Breaking changes
- For compatibility with PennyLane v0.15, the
analytic
keyword argument has been removed from all devices. Analytic expectation values can still be computed by settingshots=None
. (#65)
Contributors
This release contains contributions from (in alphabetical order):
Josh Izaac
Release 0.14.0
Improvements
- Updated the tests to work with the new core of PennyLane. (#60)
Bug fixes
-
Removed the device differentiation method from the TF device, and fixed it to work with the latest PL release. (#62)
-
Adjusted the
StrawberryFieldsGBS.jacobian
method to work with the new core of PennyLane. (#60)
Contributors
This release contains contributions from (in alphabetical order):
Theodor Isacsson, Josh Izaac.
Release 0.12.0
Release 0.12.0
New features since last release
-
A new device,
strawberryfields.tf
, provides support for using Strawberry Fields TensorFlow backend from within PennyLane. (#50)dev = qml.device('strawberryfields.tf', wires=2, cutoff_dim=10)
This device supports classical backpropagation when using the TensorFlow interface:
@qml.qnode(dev, interface="tf", diff_method="backprop") def circuit(x, theta): qml.Displacement(x, 0, wires=0) qml.Beamsplitter(theta, 0, wires=[0, 1]) return qml.probs(wires=0)
Gradients will be computed using TensorFlow backpropagation:
>>> x = tf.Variable(1.0) >>> theta = tf.Variable(0.543) >>> with tf.GradientTape() as tape: ... res = circuit(x, theta) >>> jac = tape.jacobian(res, x) >>> print(jac) <tf.Tensor: shape=(1, 10), dtype=float32, numpy= array([[-7.0436597e-01, 1.8805575e-01, 3.2707882e-01, 1.4299491e-01, 3.7763387e-02, 7.2306832e-03, 1.0900890e-03, 1.3535164e-04, 1.3895189e-05, 9.9099987e-07]], dtype=float32)>
For more details, please see the TF device documentation
-
A new device,
strawberryfields.gbs
, provides support for training of the Gaussian boson sampling (GBS) distribution. (#47)dev = qml.device('strawberryfields.gbs', wires=4, cutoff_dim=4)
This device allows the adjacency matrix
A
of a graph to be trained. The QNode must have a fixed structure:from pennylane_sf.ops import ParamGraphEmbed import numpy as np A = np.array([ [0.0, 1.0, 1.0, 1.0], [1.0, 0.0, 1.0, 0.0], [1.0, 1.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0]]) n_mean = 2.5 @qml.qnode(dev) def quantum_function(x): ParamGraphEmbed(x, A, n_mean, wires=range(4)) return qml.probs(wires=range(4))
Here,
n_mean
is the initial mean number of photons in the output GBS samples. The GBS probability distribution for a choice of trainable parametersx
can then be accessed:>>> x = 0.9 * np.ones(4) >>> quantum_function(x)
For more details, please see the gbs device documentation
Improvements
- Adds the ability for the
StrawberryFieldsGBS
device to use the reparametrization trick in sampling mode. (#55)
Bug fixes
-
Applies minor fixes to
RemoteEngine
. (#53) -
Sets a fixed cutoff dimension for
RemoteEngine
. (#54) -
Adds unwrapping for operation parameters as indexing into NumPy arrays was added to PennyLane. (#56)
Contributors
This release contains contributions from (in alphabetical order):
Juan Miguel Arrazola, Thomas Bromley, Josh Izaac.
Release 0.11.0
New features since last release
-
A new device,
strawberryfields.remote
, provides support for Xanadu's photonic hardware from within PennyLane. (#41)dev = qml.device('strawberryfields.remote', backend="X8", shots=10, sf_token="XXX")
Once created, the device can be bound to photonic QNode for evaluation and training:
@qml.qnode(dev) def quantum_function(theta, x): qml.TwoModeSqueezing(1.0, 0.0, wires=[0, 4]) qml.TwoModeSqueezing(1.0, 0.0, wires=[1, 5]) qml.Beamsplitter(theta, phi, wires=[0, 1]) qml.Beamsplitter(theta, phi, wires=[4, 5]) return qml.expval(qml.NumberOperator(0))
Samples can also be returned from the hardware using
return [qml.sample(qml.NumberOperator(i)) for i in [0, 1, 2, 4]]
For more details, please see the remote device documentation
-
The Strawberry Fields devices now support returning Fock state probabilities. (#39)
@qml.qnode(dev) def quantum_function(theta, x): qml.TwoModeSqueezing(1.0, 0.0, wires=[0, 1]) return qml.probs(wires=0)
If a subset of wires are requested, the marginal probabilities will be computed and returned. The returned probabilities will have the shape
[cutoff] * wires
.If not specified when instantiated, the cutoff for the Gaussian simulator is by default 10.
-
Added the ability to compute the expectation value and variance of tensor number operators (#37) (#42)
-
The Strawberry Fields devices now support custom wire labels. (#48)
dev = qml.device('strawberryfields.gaussian', wires=['alice', 1]) @qml.qnode(dev) def circuit(x): qml.Displacement(x, 0, wires='alice') qml.Beamsplitter(wires=['alice', 1]) return qml.probs(wires=[0, 1])
Improvements
- PennyLane-SF has been updated to support the latest version of Strawberry Fields (v0.15) (#44)
Contributors
This release contains contributions from (in alphabetical order):
Josh Izaac, Maria Schuld, Antal Száva