pytket.backends

Backends for connecting to devices and simulators directly from pytket

class pytket.backends.Backend

This abstract class defines the structure of a backend as something that can run quantum circuits and produce output as at least one of shots, counts, state, or unitary

__init__() None
cancel(handle: pytket.backends.resulthandle.ResultHandle) None

Cancel a job.

Parameters

handle (ResultHandle) – handle to job

Raises

NotImplementedError – If backend does not support job cancellation

abstract circuit_status(handle: pytket.backends.resulthandle.ResultHandle) pytket.backends.status.CircuitStatus

Return a CircuitStatus reporting the status of the circuit execution corresponding to the ResultHandle

compile_circuit(circuit: pytket.circuit.Circuit, optimisation_level: int = 1) None

Apply the default_compilation_pass to a circuit in place.

As well as applying a degree of optimisation (controlled by the optimisation_level parameter), this method tries to ensure that the circuit can be run on the backend (i.e. successfully passed to process_circuits()), for example by rebasing to the supported gate set, or routing to match the connectivity of the device. However, this is not always possible, for example if the circuit contains classical operations that are not supported by the backend. You may use valid_circuit() to check whether the circuit meets the backend’s requirements after compilation. This validity check is included in process_circuits() by default, before any circuits are submitted to the backend.

If the validity check fails, you can obtain more information about the failure by iterating through the predicates in the required_predicates property of the backend, and running the verify() method on each in turn with your circuit.

Parameters
  • circuit (Circuit) – The circuit to compile.

  • optimisation_level (int, optional) – The level of optimisation to perform during compilation. Level 0 just solves the device constraints without optimising. Level 1 additionally performs some light optimisations. Level 2 adds more intensive optimisations that can increase compilation time for large circuits. Defaults to 1.

abstract default_compilation_pass(optimisation_level: int = 1) pytket.passes.BasePass

A suggested compilation pass that will guarantee the resulting circuit will be suitable to run on this backend with as few preconditions as possible.

Parameters

optimisation_level (int, optional) – The level of optimisation to perform during compilation. Level 0 just solves the device constraints without optimising. Level 1 additionally performs some light optimisations. Level 2 adds more intensive optimisations that can increase compilation time for large circuits. Defaults to 1.

Returns

Compilation pass guaranteeing required predicates.

Return type

BasePass

empty_cache() None

Manually empty the result cache on the backend.

get_compiled_circuit(circuit: pytket.circuit.Circuit, optimisation_level: int = 1) pytket.circuit.Circuit

Return a single circuit compiled with default_compilation_pass. See Backend.get_compiled_circuits().

get_compiled_circuits(circuits: Sequence[pytket.circuit.Circuit], optimisation_level: int = 1) List[pytket.circuit.Circuit]

Compile a sequence of circuits with default_compilation_pass and return the list of compiled circuits (does not act in place).

As well as applying a degree of optimisation (controlled by the optimisation_level parameter), this method tries to ensure that the circuits can be run on the backend (i.e. successfully passed to process_circuits()), for example by rebasing to the supported gate set, or routing to match the connectivity of the device. However, this is not always possible, for example if the circuit contains classical operations that are not supported by the backend. You may use valid_circuit() to check whether the circuit meets the backend’s requirements after compilation. This validity check is included in process_circuits() by default, before any circuits are submitted to the backend.

If the validity check fails, you can obtain more information about the failure by iterating through the predicates in the required_predicates property of the backend, and running the verify() method on each in turn with your circuit.

Parameters
  • circuits – The circuits to compile.

  • optimisation_level (int, optional) – The level of optimisation to perform during compilation. Level 0 just solves the device constraints without optimising. Level 1 additionally performs some light optimisations. Level 2 adds more intensive optimisations that can increase compilation time for large circuits. Defaults to 1.

Returns

Compiled circuits.

Return type

List[Circuit]

get_counts(circuit: pytket.circuit.Circuit, n_shots: Optional[int] = None, basis: pytket.circuit.BasisOrder = BasisOrder.ilo, valid_check: bool = True, **kwargs: Optional[Union[int, float]]) Dict[Tuple[int, ...], int]

Obtain a summary of results, accumulating the shots for each result from an experiment. Accepts a Circuit to be run and immediately returned. This will fail if the circuit does not match the device’s requirements.

If the postprocess keyword argument is set to True, and the backend supports the feature (see supports_contextual_optimisation()), then contextual optimisatioons are applied before running the circuit and retrieved results will have any necessary classical postprocessing applied. This is not enabled by default.

Parameters
  • circuit (Circuit) – The circuit to run

  • n_shots (Optional[int], optional) – Number of shots to generate from the circuit. Defaults to None

  • basis (BasisOrder, optional) – Toggle between ILO (increasing lexicographic order of bit ids) and DLO (decreasing lexicographic order) for column ordering. Defaults to BasisOrder.ilo.

  • valid_check (bool, optional) – Explicitly check that the circuit satisfies all of the required predicates before running. Defaults to True

Raises

NotImplementedError – If backend implementation does not support counts retrieval

Returns

Dictionary mapping observed readouts to the number of times observed.

Return type

Dict[Tuple[int, …], int]

get_result(handle: pytket.backends.resulthandle.ResultHandle, **kwargs: Optional[Union[int, float]]) pytket.backends.backendresult.BackendResult

Return a BackendResult corresponding to the handle.

Use keyword arguments to specify parameters to be used in retrieving results. See specific Backend derived class for available parameters, from the following list:

  • timeout: maximum time to wait for remote job to finish

  • wait: polling interval between remote calls to check job status

Parameters

handle (ResultHandle) – handle to results

Returns

Results corresponding to handle.

Return type

BackendResult

get_results(handles: Iterable[pytket.backends.resulthandle.ResultHandle], **kwargs: Optional[Union[int, float]]) List[pytket.backends.backendresult.BackendResult]

Return results corresponding to handles.

Parameters

handles – Iterable of handles

Returns

List of results

Keyword arguments are as for get_result, and apply to all jobs.

get_shots(circuit: pytket.circuit.Circuit, n_shots: Optional[int] = None, basis: pytket.circuit.BasisOrder = BasisOrder.ilo, valid_check: bool = True, **kwargs: Optional[Union[int, float]]) numpy.ndarray

Obtain the table of shots from an experiment. Accepts a Circuit to be run and immediately returned. This will fail if the circuit does not match the device’s requirements.

If the postprocess keyword argument is set to True, and the backend supports the feature (see supports_contextual_optimisation()), then contextual optimisations are applied before running the circuit and retrieved results will have any necessary classical postprocessing applied. This is not enabled by default.

Parameters
  • circuit (Circuit) – The circuit to run

  • n_shots (Optional[int], optional) – Number of shots to generate from the circuit. Defaults to None

  • basis (BasisOrder, optional) – Toggle between ILO (increasing lexicographic order of bit ids) and DLO (decreasing lexicographic order) for column ordering. Defaults to BasisOrder.ilo.

  • valid_check (bool, optional) – Explicitly check that the circuit satisfies all of the required predicates before running. Defaults to True

Raises

NotImplementedError – If backend implementation does not support shot table retrieval

Returns

Table of shot results. Each row is a single shot, with columns ordered by classical bit order (according to basis). Entries are 0 or 1 corresponding to qubit basis states.

Return type

np.ndarray

get_state(circuit: pytket.circuit.Circuit, basis: pytket.circuit.BasisOrder = BasisOrder.ilo, valid_check: bool = True) numpy.ndarray

Obtain a statevector from a simulation. Accepts a Circuit to be run and immediately returned. This will fail if the circuit does not match the simulator’s requirements.

Parameters
  • circuit (Circuit) – The circuit to run

  • basis (BasisOrder, optional) – Toggle between ILO-BE (increasing lexicographic order of bit ids, big-endian) and DLO-BE (decreasing lexicographic order, big-endian) for ordering the coefficients. Defaults to BasisOrder.ilo.

  • valid_check (bool, optional) – Explicitly check that the circuit satisfies all of the required predicates before running. Defaults to True

Raises

NotImplementedError – If backend implementation does not support statevector retrieval

Returns

A big-endian statevector for the circuit in the encoding given by basis; e.g. \([a_{00}, a_{01}, a_{10}, a_{11}]\) where \(a_{01}\) is the amplitude of the \(\left|01\right>\) state (in ILO, this means qubit q[0] is in state \(\left|0\right>\) and q[1] is in state \(\left|1\right>\), and the reverse in DLO)

Return type

np.ndarray

pop_result(handle: pytket.backends.resulthandle.ResultHandle) Optional[Dict[str, Any]]

Remove cache entry corresponding to handle from the cache and return.

Parameters

handle (ResultHandle) – ResultHandle object

Returns

Cache entry corresponding to handle, if it was present

Return type

Optional[ResultCache]

process_circuit(circuit: pytket.circuit.Circuit, n_shots: Optional[int] = None, valid_check: bool = True, **kwargs: Optional[Union[int, float]]) pytket.backends.resulthandle.ResultHandle

Submit a single circuit to the backend for running. See Backend.process_circuits().

abstract process_circuits(circuits: Sequence[pytket.circuit.Circuit], n_shots: Optional[Union[int, Sequence[int]]] = None, valid_check: bool = True, **kwargs: Optional[Union[int, float]]) List[pytket.backends.resulthandle.ResultHandle]

Submit circuits to the backend for running. The results will be stored in the backend’s result cache to be retrieved by the corresponding get_<data> method.

If the postprocess keyword argument is set to True, and the backend supports the feature (see supports_contextual_optimisation()), then contextual optimisatioons are applied before running the circuit and retrieved results will have any necessary classical postprocessing applied. This is not enabled by default.

Use keyword arguments to specify parameters to be used in submitting circuits See specific Backend derived class for available parameters, from the following list:

  • seed: RNG seed for simulators

  • postprocess: if True, apply contextual optimisations

Parameters
  • circuits (Sequence[Circuit]) – Circuits to process on the backend.

  • n_shots (Optional[Union[int, Iterable[int]], optional) – Number of shots to run per circuit. Optionally, this can be a list of shots specifying the number of shots for each circuit separately. None is to be used for state/unitary simulators. Defaults to None.

  • valid_check (bool, optional) – Explicitly check that all circuits satisfy all required predicates to run on the backend. Defaults to True

Returns

Handles to results for each input circuit, as an interable in the same order as the circuits.

Return type

List[ResultHandle]

valid_circuit(circuit: pytket.circuit.Circuit) bool

Checks that the circuit satisfies all of required_predicates.

Parameters

circuit (Circuit) – The circuit to check.

Returns

Whether or not all of required_predicates are satisfied.

Return type

bool

property backend_info: Optional[pytket.backends.backendinfo.BackendInfo]

Retrieve all Backend properties in a BackendInfo object, including device architecture, supported gate set, gate errors and other hardware-specific information.

Returns

The BackendInfo describing this backend if it exists.

Return type

Optional[BackendInfo]

property characterisation: Optional[dict]

Retrieve the characterisation targeted by the backend if it exists.

Returns

The characterisation that this backend targets if it exists. The characterisation object contains device-specific information such as gate error rates.

Return type

Optional[dict]

property expectation_allows_nonhermitian: bool

If expectations are supported, is the operator allowed to be non-Hermitan?

property persistent_handles: bool

Whether the backend produces ResultHandle objects that can be reused with other instances of the backend class.

abstract property required_predicates: List[pytket.predicates.Predicate]

The minimum set of predicates that a circuit must satisfy before it can be successfully run on this backend.

Returns

Required predicates.

Return type

List[Predicate]

property supports_contextual_optimisation: bool

Does this backend support contextual optimisation?

See process_circuits().

property supports_counts: bool

Does this backend support counts result retrieval via get_counts.

property supports_density_matrix: bool

Does this backend support density matrix retrieval via get_density_matrix.

property supports_expectation: bool

Does this backend support expectation value calculation for operators.

property supports_shots: bool

Does this backend support shot result retrieval via get_shots.

property supports_state: bool

Does this backend support statevector retrieval via get_state.

property supports_unitary: bool

Does this backend support unitary retrieval via get_unitary.

pytket.backends.resulthandle

ResultHandle class

class pytket.backends.resulthandle.ResultHandle(*args: Union[int, float, complex, str, bool, bytes])

Object to store multidimensional identifiers for a circuit sent to a backend for execution.

Initialisation arguments must be hashable basic types.

Note that a ResultHandle may be either persistent or transient, depending on the backend: consult the pytket.backends.Backend.persistent_handles property to determine this.

classmethod from_str(string: str) pytket.backends.resulthandle.ResultHandle

Construct ResultHandle from string (output from str())

Raises

ValueError – If string format is invalid

Returns

Instance of ResultHandle

Return type

ResultHandle

pytket.backends.backendresult

BackendResult class and associated methods.

class pytket.backends.backendresult.BackendResult(*, q_bits: Optional[Sequence[pytket.circuit.Qubit]] = None, c_bits: Optional[Sequence[pytket.circuit.Bit]] = None, counts: Optional[Counter[pytket.utils.OutcomeArray]] = None, shots: Optional[pytket.utils.OutcomeArray] = None, state: Optional[Any] = None, unitary: Optional[Any] = None, density_matrix: Optional[Any] = None, ppcirc: Optional[pytket.circuit.Circuit] = None)

Encapsulate generic results from pytket Backend instances.

Results can either be measured (shots or counts), or ideal simulations in the form of statevector, unitary arrays or density matrices. For measured results, a map of Bit identifiers to its stored outcome index is also stored (e.g. {Bit(1):2} tells us Bit(1) corresponds to the 2 reading in the bitstring 0010). Likewise, for state results a map of Qubit identifiers to qubit location in basis vector labelling is stored (e.g. statevector index 3 corresponds to bitwise encoding 011, and a mapping {Qubit(2): 0} tells us the 0 in the bitwise encoding corresponds to Qubit(2)).

This allows results to be requested for the specific subset and ordering of units you require. For instance results for [Bit(0), Bit(1)] in that order can be requested using get_counts([Bit(0), Bit(1)]). Requests for state results must be a permutation of all Qubits, not a subset.

Parameters

ppcirc – If provided, classical postprocessing to be applied to all measured results (i.e. shots and counts).

classmethod from_dict(res_dict: Dict[str, Any]) pytket.backends.backendresult.BackendResult
Construct BackendResult object from JSON serializable dictionary

representation, as generated by BackendResult.to_dict.

Returns

Instance of BackendResult constructed from dictionary.

Return type

BackendResult

get_bitlist() List[pytket.circuit.Bit]

Return list of Bits in internal storage order.

Raises

AttributeError – BackendResult does not include a Bits list.

Returns

Sorted list of Bits.

Return type

List[Bit]

get_counts(cbits: Optional[Sequence[pytket.circuit.Bit]] = None, basis: pytket.circuit.BasisOrder = BasisOrder.ilo, ppcirc: Optional[pytket.circuit.Circuit] = None) Counter[Tuple[int, ...]]

Return counts of outcomes if available.

Parameters
  • cbits (Optional[Sequence[Bit]], optional) – ordered subset of Bits, returns all results by default, defaults to None

  • basis – Toggle between ILO (increasing lexicographic order of bit ids) and DLO (decreasing lexicographic order) for column ordering if cbits is None. Defaults to BasisOrder.ilo.

  • ppcirc – Classical post-processing circuit to apply to measured results

Raises

InvalidResultType – Counts are not available

Returns

Counts of outcomes

Return type

Counter[Tuple(int)]

get_debug_info() Dict[str, float]

Calculate the success rate of each assertion averaged across shots.

Each assertion in pytket is decomposed into a sequence of transformations and measurements. An assertion is successful if and only if all its associated measurements yield the correct results.

Returns

The debug results as a map from assertion to average success rate.

Return type

Dict[str, float]

get_density_matrix(qbits: Optional[Sequence[pytket.circuit.Qubit]] = None, basis: pytket.circuit.BasisOrder = BasisOrder.ilo) numpy.ndarray

Return density_matrix if available.

Parameters
  • qbits (Optional[Sequence[Qubit]], optional) – permutation of Qubits, defaults to None

  • basis – Toggle between ILO (increasing lexicographic order of qubit ids) and DLO (decreasing lexicographic order) for column ordering if qbits is None. Defaults to BasisOrder.ilo.

Raises

InvalidResultType – Statevector not available

Returns

density_matrix, (complex 2-D numpy array)

Return type

np.ndarray

get_distribution(units: Optional[Sequence[pytket.circuit.UnitID]] = None) Dict[Tuple[int, ...], float]

Calculate an exact or approximate probability distribution over outcomes.

If the exact statevector is known, the exact probability distribution is returned. Otherwise, if measured results are available the distribution is estimated from these results.

Parameters

units (Optional[Sequence[UnitID]], optional) – Optionally provide the Qubits or Bits to marginalise the distribution over, defaults to None

Returns

A distribution as a map from bitstring to probability.

Return type

Dict[Tuple[int, …], float]

get_qbitlist() List[pytket.circuit.Qubit]

Return list of Qubits in internal storage order.

Raises

AttributeError – BackendResult does not include a Qubits list.

Returns

Sorted list of Qubits.

Return type

List[Qubit]

get_result(request_ids: Optional[Sequence[pytket.circuit.UnitID]] = None, basis: pytket.circuit.BasisOrder = BasisOrder.ilo, ppcirc: Optional[pytket.circuit.Circuit] = None) pytket.backends.backendresult.StoredResult
Retrieve all results, optionally according to a specified UnitID ordering

or subset.

Parameters
  • request_ids (Optional[Sequence[UnitID]], optional) – Ordered set of either Qubits or Bits for which to retrieve results, defaults to None in which case all results are returned. For statevector/unitary/density_matrix results some permutation of all qubits must be requested. For measured results (shots/counts), some subset of the relevant bits must be requested.

  • basis – Toggle between ILO (increasing lexicographic order of bit ids) and DLO (decreasing lexicographic order) for column ordering if request_ids is None. Defaults to BasisOrder.ilo.

  • ppcirc – Classical post-processing circuit to apply to measured results

Raises
  • ValueError – Requested UnitIds (request_ids) contain a mixture of qubits and bits.

  • RuntimeError – Classical bits not set.

  • ValueError – Requested (Qu)Bit not in result.

  • RuntimeError – “Qubits not set.”

  • ValueError – For state/unitary/density_matrix results only a permutation of all qubits can be requested.

Returns

All stored results corresponding to requested IDs.

Return type

StoredResult

get_shots(cbits: Optional[Sequence[pytket.circuit.Bit]] = None, basis: pytket.circuit.BasisOrder = BasisOrder.ilo, ppcirc: Optional[pytket.circuit.Circuit] = None) numpy.ndarray

Return shots if available.

Parameters
  • cbits (Optional[Sequence[Bit]], optional) – ordered subset of Bits, returns all results by default, defaults to None

  • basis – Toggle between ILO (increasing lexicographic order of bit ids) and DLO (decreasing lexicographic order) for column ordering if cbits is None. Defaults to BasisOrder.ilo.

  • ppcirc – Classical post-processing circuit to apply to measured results

Raises

InvalidResultType – Shot results are not available

Returns

2D array of readouts, each row a separate outcome and each column a bit value.

Return type

np.ndarray

The order of the columns follows the order of cbits, if provided.

get_state(qbits: Optional[Sequence[pytket.circuit.Qubit]] = None, basis: pytket.circuit.BasisOrder = BasisOrder.ilo) numpy.ndarray

Return statevector if available.

Parameters
  • qbits (Optional[Sequence[Qubit]], optional) – permutation of Qubits, defaults to None

  • basis – Toggle between ILO (increasing lexicographic order of qubit ids) and DLO (decreasing lexicographic order) for column ordering if qbits is None. Defaults to BasisOrder.ilo.

Raises

InvalidResultType – Statevector not available

Returns

Statevector, (complex 1-D numpy array)

Return type

np.ndarray

get_unitary(qbits: Optional[Sequence[pytket.circuit.Qubit]] = None, basis: pytket.circuit.BasisOrder = BasisOrder.ilo) numpy.ndarray

Return unitary if available.

Parameters
  • qbits (Optional[Sequence[Qubit]], optional) – permutation of Qubits, defaults to None

  • basis – Toggle between ILO (increasing lexicographic order of qubit ids) and DLO (decreasing lexicographic order) for column ordering if qbits is None. Defaults to BasisOrder.ilo.

Raises

InvalidResultType – Statevector not available

Returns

Unitary, (complex 2-D numpy array)

Return type

np.ndarray

to_dict() Dict[str, Any]
Generate a dictionary serialized representation of BackendResult,

suitable for writing to JSON.

Returns

JSON serializable dictionary.

Return type

Dict[str, Any]

property contains_measured_results: bool

Whether measured type results (shots or counts) are stored

property contains_state_results: bool

Whether state type results (state vector or unitary or density_matrix) are stored

class pytket.backends.backendresult.StoredResult(counts: Optional[Counter[pytket.utils.OutcomeArray]] = None, shots: Optional[pytket.utils.OutcomeArray] = None, state: Optional[numpy.ndarray] = None, unitary: Optional[numpy.ndarray] = None, density_matrix: Optional[numpy.ndarray] = None)

NamedTuple with optional fields for all result types.

counts: Optional[Counter[pytket.utils.outcomearray.OutcomeArray]]

Alias for field number 0

density_matrix: Optional[numpy.ndarray]

Alias for field number 4

shots: Optional[pytket.utils.outcomearray.OutcomeArray]

Alias for field number 1

state: Optional[numpy.ndarray]

Alias for field number 2

unitary: Optional[numpy.ndarray]

Alias for field number 3

pytket.backends.status

Status classes for circuits submitted to backends.

class pytket.backends.status.CircuitStatus(status: pytket.backends.status.StatusEnum, message: str = '')

The status of a circuit along with optional long description, for example an error message.

classmethod from_dict(dic: Dict[str, Any]) pytket.backends.status.CircuitStatus

Construct from JSON serializable dictionary.

to_dict() Dict[str, Any]

Return JSON serializable dictionary representation.

message: str

Alias for field number 1

status: pytket.backends.status.StatusEnum

Alias for field number 0

class pytket.backends.status.StatusEnum(value)

Enumeration for the possible status of a circuit submitted to a backend.

pytket.backends.backendinfo

BackendInfo class: additional information on Backends

class pytket.backends.backendinfo.BackendInfo(name: str, device_name: Optional[str], version: str, architecture: pytket.routing.Architecture, gate_set: Set[pytket.circuit.OpType], supports_fast_feedforward: bool = False, supports_reset: bool = False, supports_midcircuit_measurement: bool = False, all_node_gate_errors: Optional[Dict[pytket.circuit.Node, Dict[pytket.circuit.OpType, float]]] = None, all_edge_gate_errors: Optional[Dict[Tuple[pytket.circuit.Node, pytket.circuit.Node], Dict[pytket.circuit.OpType, float]]] = None, all_readout_errors: Optional[Dict[pytket.circuit.Node, List[List[float]]]] = None, averaged_node_gate_errors: Optional[Dict[pytket.circuit.Node, float]] = None, averaged_edge_gate_errors: Optional[Dict[Tuple[pytket.circuit.Node, pytket.circuit.Node], float]] = None, averaged_readout_errors: Optional[Dict[pytket.circuit.Node, float]] = None, misc: Dict[str, Any] = <factory>)

Stores various properties of a Backend.

This provides all device information useful for compilation.

Parameters
  • name – Class name of the backend.

  • device_name – Name of the device.

  • version – Pytket-extension version installed when creating object.

  • architecture – Device connectivity.

  • gate_set – Set of supported gate types.

  • supports_fast_feedforward – Flag for hardware support of fast feedforward.

  • supports_reset – Flag for hardware support of reset operation

  • supports_midcircuit_meas – Flag for hardware support of midcircuit measurement.

  • all_node_gate_errors – Dictionary between architecture Node and error rate for different single qubit operations.

  • all_edge_gate_errors – Dictionary between architecture couplings and error rate for different two-qubit operations.

  • all_readout_errors – Dictionary between architecture Node and uncorrelated single qubit readout errors.

  • averaged_node_gate_errors – Dictionary between architecture Node and averaged error rate for all single qubit operations.

  • averaged_edge_gate_errors – Dictionary between architecture couplings and averaged error rate for all two-qubit operations.

  • averaged_readout_errors – Dictionary between architecture Node and averaged readout errors.

  • misc – key-value map with further provider-specific information

add_misc(key: str, val: Any) None

Add a new entry in BackendInfo’s dictionary of additional information.

Parameters
  • key (str) – Key to store and retrieve value.

  • val – Value to be stored.

classmethod from_dict(d: Dict[str, Any]) pytket.backends.backendinfo.BackendInfo

Construct BackendInfo object from JSON serializable dictionary representation, as generated by BackendInfo.to_dict.

Returns

Instance of BackendInfo constructed from dictionary.

Return type

BackendInfo

get_misc(key: str) Any

Retrieve information stored in Backend’s additional information store

Parameters

key (str) – Key to retrieve value.

Raises

KeyError – There is no value stored with the given key.

Returns

The value stored at the given key.

to_dict() Dict[str, Any]

Generate a dictionary serialized representation of BackendInfo, suitable for writing to JSON.

Returns

JSON serializable dictionary.

Return type

Dict[str, Any]

property n_nodes: int

Number of nodes in the architecture of the device.

Returns

Number of nodes.

Return type

int

property nodes: List[pytket.circuit.Node]

List of device nodes of the backend.

Returns

List of nodes.

Return type

List[Node]