cirq.google.SerializableDevice

class cirq.google.SerializableDevice(qubits: List[cirq.Qid], gate_definitions: Dict[Type[cirq.Gate], List[cirq.google.devices.serializable_device._GateDefinition]])[source]

Device object generated from a device specification proto.

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.
__init__(qubits: List[cirq.Qid], gate_definitions: Dict[Type[cirq.Gate], List[cirq.google.devices.serializable_device._GateDefinition]])[source]

Constructor for SerializableDevice using python objects.

Note that the preferred method of constructing this object is through
the static from_proto() call.
Parameters
  • qubits – A list of valid Qid for the device.

  • gate_definitions – Maps cirq gates to device properties for that gate.

Methods

can_add_operation_into_moment(operation, moment)

Determines if it’s possible to add an operation into a moment.

decompose_operation(operation)

Returns a device-valid decomposition for the given operation.

duration_of(operation)

from_proto(proto, gate_sets)

param proto

A proto describing the qubits on the device, as well as the

qubit_set()

Returns a set or frozenset of qubits on the device, if possible.

validate_circuit(circuit)

Raises an exception if a circuit is not valid.

validate_moment(moment)

Raises an exception if a moment is not valid.

validate_operation(operation)

Raises an exception if an operation is not valid.