Improve ConsolidateBlocks error messages for NaN/Inf gate parameters#16584
Improve ConsolidateBlocks error messages for NaN/Inf gate parameters#16584Pranava-Kumar wants to merge 1 commit into
Conversation
…iskit#16236) Add explicit NaN/Inf detection in the ConsolidateBlocks pass and include block context (gate name, parameters, qubits) in error messages, instead of propagating a non-descript NoConvergence from scipy. The error now shows which gate has NaN/Inf parameters, making debugging significantly easier. Fixes Qiskit#16236
|
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the following people are relevant to this code:
|
|
|
1 similar comment
|
|
Summary
When a circuit contains gates with NaN or Inf parameters,
ConsolidateBlockscurrently fails with a non-descriptNoConvergenceerror (from scipy's eigenvalue decomposition in the Weyl decomposition), giving no indication of the root cause. This makes debugging circuits with invalid parameters very difficult.This PR:
Before
After
Related Issues
Fixes #16236