-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
Expr
support in DAGCircuit.substitute_node
As part of this minor refactor, this updates the logic to no longer silently override conditions on the replacement `op`. The method gains a `propagate_condition` argument analogous to the same argument in `substitute_node_with_dag`, which can be set `False` to specify that the caller is aware that the new operation should implement the same conditional logic.
- Loading branch information
1 parent
ac942ee
commit e70058f
Showing
3 changed files
with
169 additions
and
9 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
15 changes: 15 additions & 0 deletions
15
releasenotes/notes/dag-substitute-node-propagate-condition-898052b53edb1f17.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,15 @@ | ||
--- | ||
features: | ||
- | | ||
:meth:`.DAGCircuit.substitute_node` gained a ``propagate_condition`` keyword argument that is | ||
analogous to the same argument in :meth:`~.DAGCircuit.substitute_node_with_dag`. Setting this | ||
to ``False`` opts out of the legacy behaviour of copying a condition on the ``node`` onto the | ||
new ``op`` that is replacing it. | ||
This option is ignored for general control-flow operations, which will never propagate their | ||
condition, nor accept a condition from another node. | ||
fixes: | ||
- | | ||
:meth:`.DAGCircuit.substitute_node` will no longer silently overwrite an existing condition on | ||
the given replacement ``op``. If ``propagate_condition`` is set to ``True`` (the default), a | ||
:exc:`.DAGCircuitError` will be raised instead. |
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