diff --git a/doc/development/guide/architecture.rst b/doc/development/guide/architecture.rst index 0f1f3e5fbd4..d42ec1bb4c5 100644 --- a/doc/development/guide/architecture.rst +++ b/doc/development/guide/architecture.rst @@ -114,12 +114,6 @@ which are themselves operators. >>> m.obs PauliZ(wires=['a']) -Furthermore, it specifies a "return type" which defines the kind of measurement performed, -such as expectation, variance, probability, state, or sample. - ->>> m.return_type -ObservableReturnTypes.Expectation - For more information, check out the documentation on :doc:`measurements ` QuantumTape diff --git a/pennylane/ops/op_math/controlled_ops.py b/pennylane/ops/op_math/controlled_ops.py index e8490d9c37a..66a84e6b240 100644 --- a/pennylane/ops/op_math/controlled_ops.py +++ b/pennylane/ops/op_math/controlled_ops.py @@ -180,7 +180,7 @@ def __init__( if hasattr(base, "wires"): warnings.warn( "QubitUnitary input to ControlledQubitUnitary is deprecated and will be removed in v0.42. " - "Instead, please use a full matrix as input.", + "Instead, please use a full matrix as input, or try qml.ctrl for controlled QubitUnitary.", qml.PennyLaneDeprecationWarning, ) base = base.matrix() diff --git a/pennylane/workflow/qnode.py b/pennylane/workflow/qnode.py index 11ef70c57ce..76275ae1940 100644 --- a/pennylane/workflow/qnode.py +++ b/pennylane/workflow/qnode.py @@ -578,7 +578,8 @@ def __init__( if kwargs: if any(k in qml.gradients.SUPPORTED_GRADIENT_KWARGS for k in list(kwargs.keys())): warnings.warn( - f"Specifying gradient keyword arguments {list(kwargs.keys())} is deprecated and will be removed in v0.42. Instead, please specify all arguments in the gradient_kwargs argument.", + f"Specifying gradient keyword arguments {list(kwargs.keys())} as additional kwargs has been deprecated and will be removed in v0.42. \ + Instead, please specify these arguments through the `gradient_kwargs` dictionary argument.", qml.PennyLaneDeprecationWarning, ) gradient_kwargs |= kwargs diff --git a/tests/capture/test_base_interpreter.py b/tests/capture/test_base_interpreter.py index 30a7679e162..d20486b8bec 100644 --- a/tests/capture/test_base_interpreter.py +++ b/tests/capture/test_base_interpreter.py @@ -143,7 +143,6 @@ def f(x): @pytest.mark.parametrize( "op_class, args, kwargs", [ - # (qml.ControlledQubitUnitary, (jnp.eye(2), [0, 1]), {}), (qml.CH, ([0, 1],), {}), (qml.CY, ([0, 1],), {}), (qml.CZ, ([0, 1],), {}), diff --git a/tests/ops/op_math/test_controlled_ops.py b/tests/ops/op_math/test_controlled_ops.py index a41a9670de2..44628308d40 100644 --- a/tests/ops/op_math/test_controlled_ops.py +++ b/tests/ops/op_math/test_controlled_ops.py @@ -163,14 +163,16 @@ def test_pairwise_consistency_with_capture(self): """Test that both combinations of control and target wires lead to the same operator""" base_op = [[0, 1], [1, 0]] - control_wires_1, wires_1 = [0, 1], [2] - op_1 = qml.ControlledQubitUnitary(base_op, wires=control_wires_1 + wires_1) + control_wires_1, target_wires_1 = [0, 1], [2] + op_1 = qml.ControlledQubitUnitary(base_op, wires=control_wires_1 + target_wires_1) assert op_1.base.wires == Wires(2) assert op_1.control_wires == Wires([0, 1]) - control_wires_2, wires_2 = [0, 1, 2], () - op_2 = qml.ControlledQubitUnitary(base_op, wires=Wires(control_wires_2) + Wires(wires_2)) + control_wires_2, target_wires_2 = [0, 1, 2], () + op_2 = qml.ControlledQubitUnitary( + base_op, wires=Wires(control_wires_2) + Wires(target_wires_2) + ) assert op_2.base.wires == Wires(2) assert op_2.control_wires == Wires([0, 1]) diff --git a/tests/test_qnode.py b/tests/test_qnode.py index e3c2e8f18fd..ce0470dafc7 100644 --- a/tests/test_qnode.py +++ b/tests/test_qnode.py @@ -43,7 +43,7 @@ def test_additional_kwargs_is_deprecated(): with pytest.warns( qml.PennyLaneDeprecationWarning, - match=r"Specifying gradient keyword arguments \[\'atol\'\] is deprecated", + match=r"Specifying gradient keyword arguments \[\'atol\'\] as additional kwargs has been deprecated", ): QNode(dummyfunc, dev, atol=1) diff --git a/tests/transforms/test_qmc_transform.py b/tests/transforms/test_qmc_transform.py index 8c399fb9be2..3558c631c3e 100644 --- a/tests/transforms/test_qmc_transform.py +++ b/tests/transforms/test_qmc_transform.py @@ -96,12 +96,12 @@ def test_apply_controlled_z(n_wires): unitary and comparing against the one provided in _make_Z.""" n_all_wires = n_wires + 1 - wires = Wires(range(n_wires)) + target_wires = Wires(range(n_wires)) control_wire = n_wires work_wires = None circ = lambda: _apply_controlled_z( - wires=wires, control_wire=control_wire, work_wires=work_wires + wires=target_wires, control_wire=control_wire, work_wires=work_wires ) u = get_unitary(circ, n_all_wires) @@ -109,7 +109,7 @@ def test_apply_controlled_z(n_wires): # because two Zs are used. z_ideal = -_make_Z(2**n_wires) - circ = lambda: qml.ControlledQubitUnitary(z_ideal, wires=control_wire + wires) + circ = lambda: qml.ControlledQubitUnitary(z_ideal, wires=control_wire + target_wires) u_ideal = get_unitary(circ, n_all_wires) assert np.allclose(u, u_ideal) @@ -121,7 +121,7 @@ def test_apply_controlled_v(n_wires): unitary and comparing against the one provided in _make_V.""" n_all_wires = n_wires + 1 - wires = Wires(range(n_wires)) + target_wires = Wires(range(n_wires)) control_wire = Wires(n_wires) circ = lambda: _apply_controlled_v(target_wire=Wires([n_wires - 1]), control_wire=control_wire) @@ -131,7 +131,7 @@ def test_apply_controlled_v(n_wires): # because two Vs are used. v_ideal = -_make_V(2**n_wires) - circ = lambda: qml.ControlledQubitUnitary(v_ideal, wires=control_wire + wires) + circ = lambda: qml.ControlledQubitUnitary(v_ideal, wires=control_wire + target_wires) u_ideal = get_unitary(circ, n_all_wires) assert np.allclose(u, u_ideal)