Skip to content

Commit

Permalink
Update documentation of quantum_fisher (#6074)
Browse files Browse the repository at this point in the history
**Context:**
The documentation of `qinfo.quantum_fisher` was not quite precise on
when `adjoint_metric_tensor` is being used (successfully), and did not
mention potential auxiliary wire requirements.

**Description of the Change:**
Make the criterion on using default.qubit precise (because we catch
other devices), and mention that for other settings, an auxiliary wire
may be required.

**Benefits:**

**Possible Drawbacks:**

**Related GitHub Issues:**
#6059 
[sc-70300]
  • Loading branch information
dwierichs committed Aug 7, 2024
1 parent 0ffd5d0 commit f2a558a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
4 changes: 4 additions & 0 deletions doc/releases/changelog-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@

<h3>Documentation 📝</h3>

* Improves the docstring for `qinfo.quantum_fisher` regarding the internally used functions and
potentially required auxiliary wires.
[(#6074)](https://github.com/PennyLaneAI/pennylane/pull/6074)

* Improves the docstring for `QuantumScript.expand` and `qml.tape.tape.expand_tape`.
[(#5974)](https://github.com/PennyLaneAI/pennylane/pull/5974)

Expand Down
9 changes: 6 additions & 3 deletions pennylane/gradients/fisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,12 @@ def quantum_fisher(
.. note::
``quantum_fisher`` coincides with the ``metric_tensor`` with a prefactor of :math:`4`. Internally, :func:`~.pennylane.adjoint_metric_tensor` is used when executing on a device with
exact expectations (``shots=None``) that inherits from ``"default.qubit"``. In all other cases, i.e. if a device with finite shots is used, the hardware compatible transform :func:`~.pennylane.metric_tensor` is used.
Please refer to their respective documentations for details on the arguments.
``quantum_fisher`` coincides with the ``metric_tensor`` with a prefactor of :math:`4`.
Internally, :func:`~.pennylane.adjoint_metric_tensor` is used when executing on ``"default.qubit"``
with exact expectations (``shots=None``). In all other cases, e.g. if a device with finite shots
is used, the hardware-compatible transform :func:`~.pennylane.metric_tensor` is used, which
may require an additional wire on the device.
Please refer to the respective documentations for details.
**Example**
Expand Down
9 changes: 6 additions & 3 deletions pennylane/qinfo/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,9 +651,12 @@ def quantum_fisher(
.. note::
``quantum_fisher`` coincides with the ``metric_tensor`` with a prefactor of :math:`4`. Internally, :func:`~.pennylane.adjoint_metric_tensor` is used when executing on a device with
exact expectations (``shots=None``) that inherits from ``"default.qubit"``. In all other cases, i.e. if a device with finite shots is used, the hardware compatible transform :func:`~.pennylane.metric_tensor` is used.
Please refer to their respective documentations for details on the arguments.
``quantum_fisher`` coincides with the ``metric_tensor`` with a prefactor of :math:`4`.
Internally, :func:`~.pennylane.adjoint_metric_tensor` is used when executing on ``"default.qubit"``
with exact expectations (``shots=None``). In all other cases, e.g. if a device with finite shots
is used, the hardware-compatible transform :func:`~.pennylane.metric_tensor` is used, which
may require an additional wire on the device.
Please refer to the respective documentations for details.
**Example**
Expand Down

0 comments on commit f2a558a

Please sign in to comment.