Skip to content

Revert "Remove the pennylane.noise module (#10214)" - #10256

Open
JerryChen97 wants to merge 4 commits into
mainfrom
jerrychen97-revert-remove-noise-module
Open

JerryChen97 wants to merge 4 commits into
mainfrom
jerrychen97-revert-remove-noise-module

Conversation

@JerryChen97

@JerryChen97 JerryChen97 commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Note

Drafted with AI assistance (GitHub Copilot CLI), reviewed before opening.

Context:

#10214 removed the pennylane.noise module. This PR reverts that removal, to unblock Catalyst.

Description of the Change:

Reverts 0012c52, restoring:

  • qp.noise, qp.NoiseModel, qp.add_noise, qp.insert
  • mitigate_with_zne, fold_global, poly_extrapolate, richardson_extrapolate, exponential_extrapolate
  • qp.from_qiskit_noise
  • the doc/code/qp_noise.rst page and doc/index.rst entry, the pennylane.noise tach.toml module entry (tertiary layer), and the tests/noise/ suite

Two deviations from a pure git revert:

  1. doc/development/deprecations.rst conflict. Remove the qp.pulse module #10238 (pulse removal) added entries at the same location, so main's entries were kept and only the pennylane.noise bullet was dropped.
  2. Second commit drops three TensorFlow tests from tests/noise/test_mitigate.py (test_exponential_extrapolation_tf, test_diffability_tf, test_diffability_tf_multi). They predate the removal of TensorFlow interface support from main, so tf is no longer a registered pytest marker, no CI job selects it, and a local run fails on ModuleNotFoundError: No module named 'tensorflow'. Equivalent autograd, torch and jax coverage is retained.

The changelog entry for #10214 is removed rather than replaced with a "reverted" bullet, so the net changelog reads as if the removal never landed. Happy to add an explicit entry if reviewers prefer.

Benefits:

Restores the noise-model and ZNE mitigation API for callers that still depend on it.

Possible Drawbacks:

Re-adds the module surface that #10214 set out to drop. As noted in that PR, _preprocess_device in pennylane/devices/device_api.py returns to being uncovered (the # pragma: no cover added by #10214 is reverted along with it).

Related GitHub Issues:

Reverts #10214

JerryChen97 and others added 2 commits October 2, 2026 14:24
This reverts commit 0012c52.

Restores the `pennylane.noise` module and its re-exports (`qp.noise`,
`qp.NoiseModel`, `qp.add_noise`, `qp.insert`, the ZNE mitigation
transforms, and `qp.from_qiskit_noise`), along with the docs, tach
module entry and tests that were removed alongside it.

Conflict in `doc/development/deprecations.rst`: #10238 (pulse removal)
added entries at the same location, so main's entries were kept and only
the `pennylane.noise` bullet was dropped.

Drafted with AI assistance (GitHub Copilot CLI), reviewed before committing.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reverted tests predate the removal of TensorFlow interface support
from main, so `test_exponential_extrapolation_tf`, `test_diffability_tf`
and `test_diffability_tf_multi` can no longer run: `tf` is not a
registered pytest marker, no CI job selects it, and a local run fails on
`ModuleNotFoundError: No module named 'tensorflow'`.

Equivalent autograd, torch and jax coverage is retained.

Drafted with AI assistance (GitHub Copilot CLI), reviewed before committing.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@JerryChen97
JerryChen97 requested a review from andrijapau October 2, 2026 18:29
@JerryChen97
JerryChen97 marked this pull request as ready for review October 2, 2026 18:29
@JerryChen97 JerryChen97 self-assigned this Oct 2, 2026
@JerryChen97 JerryChen97 added the urgent Mark a pull request as high priority label Oct 2, 2026
@JerryChen97
JerryChen97 requested a review from a team October 2, 2026 20:08
@codecov

codecov Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.43%. Comparing base (a222dc9) to head (9149639).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10256      +/-   ##
==========================================
+ Coverage   99.41%   99.43%   +0.02%     
==========================================
  Files         603      609       +6     
  Lines       66975    67569     +594     
==========================================
+ Hits        66580    67187     +607     
+ Misses        395      382      -13     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Codecov flagged 7 uncovered lines on #10256. These are defensive paths
that the restored test suite does not exercise:

- `_check_position`: the two `except AttributeError` handlers, which are
  already guarded by `isinstance(..., type)` before the `issubclass`
  call.
- the `stop_at` guard clauses in `insert` and `add_noise`, which bail out
  on non-`Operator` objects and operators without a decomposition.

Excluded with `# pragma: no cover` rather than adding tests, as requested
on the PR.

Drafted with AI assistance (GitHub Copilot CLI), reviewed before committing.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

urgent Mark a pull request as high priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants