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):