From 596127ace97ab14600116d24cf14dbe58c0fe785 Mon Sep 17 00:00:00 2001 From: lillian542 <38584660+lillian542@users.noreply.github.com> Date: Wed, 21 Jun 2023 15:19:23 -0400 Subject: [PATCH] Update docs (#4269) * Incrementing the version number to `v0.32.0-dev` (#4266) * pre-release for v0.31.0 * Update doc/releases/changelog-0.31.0.md * Incrementing the version number to v0.32.0-dev * Update installation.rst (#4247) Update Python version to 3.8 Co-authored-by: Romain Moyard * docs typos * don't include updating versioning from master * don't include python requirements from master * update example output for shot_vector * Update pennylane/operation.py Co-authored-by: Matthew Silverman * fix entirely unrelated rendering issue --------- Co-authored-by: Matthew Silverman Co-authored-by: Catalina Albornoz Co-authored-by: Romain Moyard --- pennylane/gradients/__init__.py | 1 - pennylane/operation.py | 2 +- pennylane/pulse/convenience_functions.py | 2 +- pennylane/tape/qscript.py | 2 +- pennylane/transforms/batch_transform.py | 5 ++++- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pennylane/gradients/__init__.py b/pennylane/gradients/__init__.py index d70636eed8e..93d080204bd 100644 --- a/pennylane/gradients/__init__.py +++ b/pennylane/gradients/__init__.py @@ -264,7 +264,6 @@ def circuit(weights): ops = [ qml.RX(weights[0], wires=0), - qml.RY(weights[1], wires=1), qml.CNOT(wires=[0, 1]), qml.RX(weights[2], wires=1)] diff --git a/pennylane/operation.py b/pennylane/operation.py index 6a3919dc9d7..91288409787 100644 --- a/pennylane/operation.py +++ b/pennylane/operation.py @@ -705,7 +705,7 @@ def compute_matrix(*params, **hyperparams): # pylint:disable=unused-argument The canonical matrix is the textbook matrix representation that does not consider wires. Implicitly, this assumes that the wires of the operator correspond to the global wire order. - .. seealso:: :meth:`.Operator.matrix` and :func:`qml.matrix` + .. seealso:: :meth:`.Operator.matrix` and :func:`qml.matrix() ` Args: *params (list): trainable parameters of the operator, as stored in the ``parameters`` attribute diff --git a/pennylane/pulse/convenience_functions.py b/pennylane/pulse/convenience_functions.py index 97240799000..e102197fedb 100644 --- a/pennylane/pulse/convenience_functions.py +++ b/pennylane/pulse/convenience_functions.py @@ -234,7 +234,7 @@ def wrapped(p, t): time = jnp.linspace(0, 10, 1000) timespan=(2, 7) y = qml.pulse.pwc(timespan)(params, time) - plt.plot(time, y, label=f"params={params},\ntimespan={timespan}") + plt.plot(time, y, label=f"params={params}, timespan={timespan}") plt.legend() plt.show() diff --git a/pennylane/tape/qscript.py b/pennylane/tape/qscript.py index eccb8d3c95b..77f33a50938 100644 --- a/pennylane/tape/qscript.py +++ b/pennylane/tape/qscript.py @@ -171,7 +171,7 @@ class QuantumScript: >>> s_vec = [1, 1, 2, 2, 2] >>> qscript = QuantumScript([qml.Hadamard(0)], [qml.expval(qml.PauliZ(0))], shots=s_vec) >>> qscript.shots.shot_vector - (ShotCopies(shots=1, copies=2), ShotCopies(shots=2, copies=3)) + (ShotCopies(1 shots x 2), ShotCopies(2 shots x 3)) ``ops``, ``measurements``, and ``prep`` are converted to lists upon initialization, so those arguments accept any iterable object: diff --git a/pennylane/transforms/batch_transform.py b/pennylane/transforms/batch_transform.py index fe9d7515667..53b9836d77a 100644 --- a/pennylane/transforms/batch_transform.py +++ b/pennylane/transforms/batch_transform.py @@ -82,6 +82,9 @@ def my_transform(tape, a, b): '''Generates two tapes, one with all RX replaced with RY, and the other with all RX replaced with RZ.''' + ops1 = [] + ops2 = [] + # loop through all operations on the input tape for op in tape._ops: if op.name == "RX": @@ -94,7 +97,7 @@ def my_transform(tape, a, b): ops1.append(op) ops2.append(op) - tape1 = qml.tape.QuantumTape(ops1, tape.measurments, tape._prep) + tape1 = qml.tape.QuantumTape(ops1, tape.measurements, tape._prep) tape2 = qml.tape.QuantumTape(ops2, tape.measurements, tape._prep) def processing_fn(results):