Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Prototype] Integrating PennyLane with error mitigation #1183

Closed
wants to merge 15 commits into from

Conversation

trbromley
Copy link
Contributor

This is a prototype of how error mitigation can be integrated into PennyLane using the mitiq package.

@github-actions
Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit .github/CHANGELOG.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

try:
from mitiq.mitiq_qiskit import to_qiskit
except ImportError as e:
raise ImportError("The mitiq package is required") from e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible that a user may have mitiq but not have qiskit and hit this error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed!

dev.execute = execute
dev.batch_execute = batch_execute

return dev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

return cirq_operation_map


def _tape_to_cirq(tape):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a useful enough transform that it deserves not only to be public, but to be in its own module

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cool thing is that we have a lot of these transformations already, just wrapped up in a device (e.g., this was from PennyLane-Cirq)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, was thinking the same thing!

@codecov
Copy link

codecov bot commented Apr 1, 2021

Codecov Report

Merging #1183 (b8bb29d) into master (27896b4) will decrease coverage by 0.78%.
The diff coverage is 14.56%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1183      +/-   ##
==========================================
- Coverage   98.12%   97.34%   -0.79%     
==========================================
  Files         144      145       +1     
  Lines       10846    10948     +102     
==========================================
+ Hits        10643    10657      +14     
- Misses        203      291      +88     
Impacted Files Coverage Δ
pennylane/transforms/mitigation.py 9.27% <9.27%> (ø)
pennylane/_qubit_device.py 98.90% <100.00%> (+0.01%) ⬆️
pennylane/transforms/__init__.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 27896b4...b8bb29d. Read the comment docs.

@nathanshammah
Copy link

Very cool!

@trbromley
Copy link
Contributor Author

Closing as this was re-implemented in #1813

@trbromley trbromley closed this Oct 29, 2021
@trbromley trbromley deleted the mitigation_transform branch October 29, 2021 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants