From 1d28c69326e4eee43da20748885242e810bad5f7 Mon Sep 17 00:00:00 2001 From: Isaac De Vlugt <34751083+isaacdevlugt@users.noreply.github.com> Date: Tue, 17 Sep 2024 14:44:40 -0400 Subject: [PATCH] `qinfo` module deprecations and removals (#5911) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Context:** As part of our v0.39 deprecation cycle, `qinfo` will be deprecated. All PRs for deprecating each function can be merged to here, **Description of the Change:** Deprecates `qinfo`. Specifically: - [x] deprecate `qinfo.mutual_info`: https://github.com/PennyLaneAI/pennylane/pull/5917 - [x] deprecate `qinfo.reduced_dm`: https://github.com/PennyLaneAI/pennylane/pull/5915 - [x] deprecate `qinfo.purity`: https://github.com/PennyLaneAI/pennylane/pull/5916 - [x] deprecate `qinfo.vn_entropy`: https://github.com/PennyLaneAI/pennylane/pull/5912 - [x] deprecate `qinfo.vn_entanglement_entropy` https://github.com/PennyLaneAI/pennylane/pull/5914 - [x] deprecate `qinfo.fidelity`: https://github.com/PennyLaneAI/pennylane/pull/5915 - [x] deprecate `qinfo.relative_entropy`: https://github.com/PennyLaneAI/pennylane/pull/5915 - [x] deprecate `qinfo.trace_distance` - [x] remove `qinfo.classical_fisher` - [x] remove `qinfo.quantum_fisher` **Benefits:** Desired UI and less redundancies. **Possible Drawbacks:** None **Related GitHub Issues:** [sc-67217] [sc-67216] [sc-66716] [sc-66715] [sc-66714] [sc-66713] [sc-67664] [sc-67665] [sc-67663] [sc-67446] --------- Co-authored-by: Mudit Pandey Co-authored-by: Astral Cai Co-authored-by: Ahmed Darwish Co-authored-by: Cristian Emiliano Godinez Ramirez <57567043+EmilianoG-byte@users.noreply.github.com> Co-authored-by: Ali Asadi <10773383+maliasadi@users.noreply.github.com> Co-authored-by: albi3ro Co-authored-by: Christina Lee Co-authored-by: ringo-but-quantum Co-authored-by: David Wierichs Co-authored-by: Thomas R. Bromley <49409390+trbromley@users.noreply.github.com> Co-authored-by: Korbinian Kottmann <43949391+Qottmann@users.noreply.github.com> Co-authored-by: Tonmoy Bhattacharya Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Vincent Michaud-Rioux Co-authored-by: Matthew Silverman Co-authored-by: Guillermo Alonso-Linaje <65235481+KetpuntoG@users.noreply.github.com> Co-authored-by: Utkarsh Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com> Co-authored-by: Romain Moyard Co-authored-by: Diksha Dhawan <40900030+ddhawan11@users.noreply.github.com> Co-authored-by: soranjh Co-authored-by: Jorge J. Martínez de Lejarza <61199780+gmlejarza@users.noreply.github.com> Co-authored-by: anthayes92 <34694788+anthayes92@users.noreply.github.com> Co-authored-by: Alex Preciado Co-authored-by: Mikhail Andrenkov Co-authored-by: Jack Brown Co-authored-by: Austin Huang <65315367+austingmhuang@users.noreply.github.com> Co-authored-by: Pietropaolo Frisoni Co-authored-by: Justin Pickering <79890410+justinpickering@users.noreply.github.com> Co-authored-by: lillian542 <38584660+lillian542@users.noreply.github.com> Co-authored-by: Will Co-authored-by: Josh Izaac Co-authored-by: Lee James O'Riordan Co-authored-by: Pietropaolo Frisoni --- doc/code/qml_qinfo.rst | 8 ++++++-- doc/development/deprecations.rst | 14 +++++++++++++- doc/releases/changelog-dev.md | 4 ++++ pennylane/measurements/mutual_info.py | 2 +- pennylane/measurements/purity.py | 2 +- pennylane/measurements/vn_entropy.py | 2 +- 6 files changed, 26 insertions(+), 6 deletions(-) diff --git a/doc/code/qml_qinfo.rst b/doc/code/qml_qinfo.rst index dd0d4741177..02674bbce41 100644 --- a/doc/code/qml_qinfo.rst +++ b/doc/code/qml_qinfo.rst @@ -4,8 +4,12 @@ qml.qinfo Overview -------- -.. warning:: - The `qinfo` module is deprecated and scheduled to be removed in v0.40. +.. warning:: + + The ``qinfo`` module is deprecated and scheduled to be removed in v0.40. Most quantum information transforms + are available as measurement processes (see the :mod:`~pennylane.measurements` module for more details). + Additionally, the transforms are also available as standalone functions in the :mod:`~pennylane.math` and + :mod:`~pennylane.gradients` modules. This module provides a collection of methods to return quantum information quantities from :class:`~.QNode` returning :func:`~pennylane.state`. diff --git a/doc/development/deprecations.rst b/doc/development/deprecations.rst index 4c65d024cd8..f44598fc765 100644 --- a/doc/development/deprecations.rst +++ b/doc/development/deprecations.rst @@ -9,12 +9,18 @@ deprecations are listed below. Pending deprecations -------------------- +* The ``qml.qinfo`` module has been deprecated. Please see the respective functions in the ``qml.math`` and ``qml.measurements`` + modules instead. + + - Deprecated in v0.39 + - Will be removed in v0.40 + * ``Device``, ``QubitDevice``, and ``QutritDevice`` will no longer be imported top level in v0.40. They instead we be available as ``qml.devices.LegacyDevice``, ``qml.devices.QubitDevice``, and ``qml.devices.QutritDevice`` respectively. - Deprecated top level access in v0.39 - - Top level access removed in v0.40 + - Top level access will be removed in v0.40 * `QNode.gradient_fn` is deprecated. Please use `QNode.diff_method` instead. `QNode.get_gradient_fn` can also be used to process the diff method. @@ -83,6 +89,12 @@ Other deprecations Completed deprecation cycles ---------------------------- +* The functions ``qml.qinfo.classical_fisher`` and ``qml.qinfo.quantum_fisher`` have been removed and migrated to the ``qml.gradients`` + module. Therefore, ``qml.gradients.classical_fisher`` and ``qml.gradients.quantum_fisher`` should be used instead. + + - Deprecated in v0.38 + - Removed in v0.39 + * All of the legacy devices (any with the name ``default.qubit.{autograd,torch,tf,jax,legacy}``) are removed. Use ``default.qubit`` instead, as it supports backpropagation for the many backends the legacy devices support. diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 07b773410f3..bd574a98155 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -101,6 +101,10 @@

Deprecations 👋

+* The `qml.qinfo` module has been deprecated. Please see the respective functions in the `qml.math` and + `qml.measurements` modules instead. + [(#5911)](https://github.com/PennyLaneAI/pennylane/pull/5911) + * The ``QubitStateVector`` template is deprecated. Instead, use ``StatePrep``. [(#6172)](https://github.com/PennyLaneAI/pennylane/pull/6172) diff --git a/pennylane/measurements/mutual_info.py b/pennylane/measurements/mutual_info.py index 18335fe4306..81e39864896 100644 --- a/pennylane/measurements/mutual_info.py +++ b/pennylane/measurements/mutual_info.py @@ -74,7 +74,7 @@ def circuit_mutual(x): using the classical backpropagation differentiation method (``diff_method="backprop"``) with a compatible device and finite differences (``diff_method="finite-diff"``). - .. seealso:: :func:`~.vn_entropy`, :func:`pennylane.qinfo.transforms.mutual_info` and :func:`pennylane.math.mutual_info` + .. seealso:: :func:`~pennylane.vn_entropy`, :func:`pennylane.math.mutual_info` """ wires0 = qml.wires.Wires(wires0) wires1 = qml.wires.Wires(wires1) diff --git a/pennylane/measurements/purity.py b/pennylane/measurements/purity.py index 83e4166cbc9..4427f16231d 100644 --- a/pennylane/measurements/purity.py +++ b/pennylane/measurements/purity.py @@ -57,7 +57,7 @@ def circuit_purity(p): >>> circuit_purity(0.1) array(0.7048) - .. seealso:: :func:`pennylane.qinfo.transforms.purity` and :func:`pennylane.math.purity` + .. seealso:: :func:`pennylane.math.purity` """ wires = Wires(wires) return PurityMP(wires=wires) diff --git a/pennylane/measurements/vn_entropy.py b/pennylane/measurements/vn_entropy.py index 73a5df8651f..e07789add66 100644 --- a/pennylane/measurements/vn_entropy.py +++ b/pennylane/measurements/vn_entropy.py @@ -65,7 +65,7 @@ def circuit_entropy(x): using the classical backpropagation differentiation method (``diff_method="backprop"``) with a compatible device and finite differences (``diff_method="finite-diff"``). - .. seealso:: :func:`pennylane.qinfo.transforms.vn_entropy` and :func:`pennylane.math.vn_entropy` + .. seealso:: :func:`pennylane.math.vn_entropy` """ wires = Wires(wires) return VnEntropyMP(wires=wires, log_base=log_base)