File tree 1 file changed +10
-3
lines changed
cirq-google/cirq_google/devices
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,12 @@ def __post_init__(self):
134
134
135
135
136
136
def _in_or_equals (g : GateOrFamily , gate_family : cirq .GateFamily ):
137
- return (isinstance (g , cirq .GateFamily ) and g == gate_family ) or g in gate_family
137
+ if isinstance (g , cirq .GateFamily ):
138
+ return g == gate_family
139
+ elif isinstance (g , cirq .Gate ):
140
+ return g in gate_family
141
+ else : # Gate type
142
+ return cirq .GateFamily (g ) == gate_family
138
143
139
144
140
145
def _validate_device_specification (proto : v2 .device_pb2 .DeviceSpecification ) -> None :
@@ -469,8 +474,10 @@ def to_proto(
469
474
DeviceSpecification.
470
475
"""
471
476
qubits = self ._metadata .qubit_set
472
- pairs : List [Tuple [cirq .GridQubit , cirq .GridQubit ]] = [
473
- tuple (sorted (pair )) for pair in self ._metadata .qubit_pairs
477
+ unordered_pairs = [tuple (pair_set ) for pair_set in self ._metadata .qubit_pairs ]
478
+ pairs = [
479
+ (pair [0 ], pair [1 ]) if pair [0 ] <= pair [1 ] else (pair [1 ], pair [0 ])
480
+ for pair in unordered_pairs
474
481
]
475
482
gateset = self ._metadata .gateset
476
483
gate_durations = self ._metadata .gate_durations
You can’t perform that action at this time.
0 commit comments