|View source on GitHub|
Device object generated from a device specification proto.
cirq_google.devices.SerializableDevice( qubits: List['cirq.Qid'], gate_definitions: Dict[Type['cirq.Gate'], List[_GateDefinition]] )
Given a device specification proto and a gate_set to translate the serialized gate_ids to cirq Gates, this will generate a Device that can verify operations and circuits for the hardware specified by the device.
Expected usage is through constructing this class through a proto using the static function call from_proto().
This class only supports GridQubits and NamedQubits. NamedQubits with names that conflict (such as "4_3") may be converted to GridQubits on deserialization.
||A list of valid Qid for the device.|
||Maps cirq gates to device properties for that gate.|
can_add_operation_into_moment( operation: "cirq.Operation", moment: "cirq.Moment" ) -> bool
Determines if it's possible to add an operation into a moment.
For example, on the XmonDevice two CZs shouldn't be placed in the same moment if they are on adjacent qubits.
||The operation being added.|
||The moment being transformed.|
|Whether or not the moment will validate after adding the operation.|
decompose_operation( operation: "cirq.Operation" ) -> "cirq.OP_TREE"
Returns a device-valid decomposition for the given operation.
This method is used when adding operations into circuits with a device specified, to avoid spurious failures due to e.g. using a Hadamard gate that must be decomposed into native gates.
duration_of( operation: "cirq.Operation" ) -> Duration
cirq_google.api.v2.device_pb2.DeviceSpecification, gate_sets: Iterable[
cirq_google.serializable_gate_set.SerializableGateSet] ) -> "SerializableDevice"
Args: proto: A proto describing the qubits on the device, as well as the supported gates and timing information. gate_set: A SerializableGateSet that can translate the gate_ids into cirq Gates.
qubit_set() -> FrozenSet['cirq.Qid']
Returns a set or frozenset of qubits on the device, if possible.
If the device has a finite set of qubits, then a set or frozen set
of all qubits on the device is returned.
If the device has no well defined finite set of qubits (e.g.
validate_circuit( circuit: "cirq.Circuit" ) -> None
Raises an exception if a circuit is not valid.
||The circuit to validate.|
||The circuit isn't valid for this device.|
validate_moment( moment: "cirq.Moment" ) -> None
Raises an exception if a moment is not valid.
||The moment to validate.|
||The moment isn't valid for this device.|
validate_operation( operation: "cirq.Operation" ) -> None
Raises an exception if an operation is not valid.
||The operation to validate.|
||The operation isn't valid for this device.|