-
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 option to skip deepcopy on dag_to_circuit (#9825)
* Add option to skip deepcopy on dag_to_circuit This commit adds a new option, copy_operations, which allows to disable the deepcopy on dag_to_circuit(). Previously the dag to circuit converter would always deep copy the operations, however in the transpiler we don't need this extra overhead because the DAGCircuits are temporary internal artifacts and will not be resused outside of the transpiler. So we can avoid the copy overhead in these situations, however in general the converter needs to default to copying. This new argument enables this workflow by keeping the current behavior by default but enabling the transpiler to skip copying operations in the output conversion. * Fix docs typo * Fix docs typo again * Use copy_operations=False in more locations
- Loading branch information
Showing
8 changed files
with
32 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
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
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
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
10 changes: 10 additions & 0 deletions
10
releasenotes/notes/deepcopy-option-dag_to_circuit-2974aa9e66dc7643.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,10 @@ | ||
--- | ||
features: | ||
- | | ||
Added a new option, ``copy_operations``, to :func:`~.dag_to_circuit` to | ||
enable optionally disabling deep copying the operations from the input | ||
:class`~.DAGCircuit` to the output :class:`~.QuantumCircuit`. In cases | ||
where the input :class`~.DAGCircuit` is not used anymore after conversion | ||
this deep copying is unnecessary overhead as any shared references wouldn't | ||
have any potential unwanted side effects if the input :class`~.DAGCircuit` | ||
is discarded. |