-
Notifications
You must be signed in to change notification settings - Fork 984
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Tags and TaggedOperation class (#2670)
Add TaggedOperation class that wraps Operation and adds ability to tag operations. This PR adds a TaggedOperation class which is a wrapper around a sub-Operation but contains unstructured meta-data that can be associated with this operation. This meta-data can be used to distinguish this instance of the operation from other operations of the same type. Possible uses include using tags to signal optimization passes to skip the operation, marking operations as noise to aid in composing noise models, and giving hardware specific information. Any modification of this operation will default to dropping the tags, as the tags are considered to apply only to that specific operation.
- Loading branch information
1 parent
1e5bf55
commit 2715417
Showing
8 changed files
with
301 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -254,6 +254,7 @@ | |
SWAP, | ||
SwapPowGate, | ||
T, | ||
TaggedOperation, | ||
ThreeQubitGate, | ||
ThreeQubitDiagonalGate, | ||
TOFFOLI, | ||
|
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 |
---|---|---|
|
@@ -202,6 +202,7 @@ | |
Gate, | ||
Operation, | ||
Qid, | ||
TaggedOperation, | ||
) | ||
|
||
from cirq.ops.swap_gates import ( | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"cirq_type": "TaggedOperation", | ||
"sub_operation": | ||
{ | ||
"cirq_type": "SingleQubitPauliStringGateOperation", | ||
"pauli": | ||
{ | ||
"cirq_type": "_PauliX", | ||
"exponent": 1.0, | ||
"global_shift": 0.0 | ||
}, | ||
"qubit": { | ||
"cirq_type": "NamedQubit", | ||
"name": "q1" | ||
} | ||
}, | ||
"tags": | ||
[ | ||
"tag1", | ||
"tag2" | ||
] | ||
} |
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 @@ | ||
cirq.TaggedOperation(cirq.X.on(cirq.NamedQubit('q1')), 'tag1', 'tag2') |
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