-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add meas_level, meas_return, and noise_model options to BackendSample…
…rV2 (#13357) * Add meas_level, meas_return, and noise_model options to BackendSamaplerV2 This change adds support to the `BackendSamplerV2` class so that it will pass through the `meas_level`, `meas_return`, and `noise_model` options passed to it through to the underlying `BackendV2`'s `run()` method. For the sake of compatibility with backends that might not expect those options, it does not pass default values for them (like the previously defined options for the class) if the default `None` value is not overridden. Additionally, to support `meas_level=1`, the results processing code checks the `meas_level` option and handles `meas_level=1` data appropriately, rather than always assuming the returned data is level 2. * Fix type signature for BackendSamplerV2 internal result handling * Switch from individual new options to a run_options option run_options is a dict passed on to backend.run as it is for SamplerV2 in qiskit-aer. * Add test of using level 1 data with BackendSamplerV2 * Do not clear circuit metadata for BackendSamplerV2 All of the backend primitives use the same helper function for calling `backend.run` and this function has been clearing metadata because the estimator primitives can add large objects to the metadata that payload large for running the circuits on a remote service. In some cases, it is helpful to have the circuit metadata make it to the `backend.run` call. Since the concern about large metadata entries should not affect the sampler case, an option is added here to skip clearing the metadata and `BackendSamplerV2` is updated to use this option. * Add release notes * black
- Loading branch information
Showing
4 changed files
with
193 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
releasenotes/notes/backend-sampler-v2-level1-dc13af460cd38454.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
features: | ||
- | | ||
Support for level 1 data was added to :class:`~.BackendSamplerV2` as was | ||
support for passing options through to the ``run()`` method of the wrapped | ||
:class:`~.BackendV2`. The run options can be specified using a | ||
``"run_options"`` entry inside of the ``options`` dicitonary passed to | ||
:class:`~.BackendSamplerV2`. The ``"run_options"`` entry should be a | ||
dictionary mapping argument names to values for passing to the backend's | ||
``run()`` method. When a ``"meas_level"`` option with a value of 1 is set | ||
in the run options, the results from the backend will be treated as level 1 | ||
results rather as bit arrays (the level 2 format). | ||
upgrade: | ||
- | | ||
When using :class:`~.BackendSamplerV2`, circuit metadata is no longer | ||
cleared before passing circuits to the ``run()`` method of the wrapped | ||
:class:`~.BackendV2` instance. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters