cirq.testing.ValidatingTestDevice
A fake device that was created to ensure certain Device validation features are leveraged in Circuit functions.
Inherits From: Device
cirq.testing.ValidatingTestDevice(
qubits: AbstractSet[cirq.Qid
],
name: str = 'ValidatingTestDevice',
allowed_gates: Tuple[type, ...] = (ops.Gate,),
allowed_qubit_types: Tuple[type, ...] = (devices.GridQubit,),
validate_locality: bool = False,
auto_decompose_gates: Tuple[type, ...] = tuple()
)
It contains the minimum set of features that tests
require. Feel free to extend the features here as needed.
Args |
qubits
|
set of qubits on this device
|
name
|
the name for repr
|
allowed_gates
|
tuple of allowed gate types
|
allowed_qubit_types
|
tuple of allowed qubit types
|
validate_locality
|
if True, device will validate 2 qubit operations
(except MeasurementGateOperations) whether the two qubits are adjacent. If True,
GridQubits are assumed to be part of the allowed_qubit_types
|
auto_decompose_gates
|
when set, for given gates it calls the cirq.decompose protocol
|
Attributes |
metadata
|
Returns the associated Metadata with the device if applicable.
|
Methods
validate_circuit
View source
validate_circuit(
circuit: 'cirq.AbstractCircuit'
) -> None
Raises an exception if a circuit is not valid.
Args |
circuit
|
The circuit to validate.
|
Raises |
ValueError
|
The circuit isn't valid for this device.
|
validate_moment
View source
validate_moment(
moment: 'cirq.Moment'
) -> None
Raises an exception if a moment is not valid.
Args |
moment
|
The moment to validate.
|
Raises |
ValueError
|
The moment isn't valid for this device.
|
validate_operation
View source
validate_operation(
operation: cirq.Operation
) -> None
Raises an exception if an operation is not valid.
Args |
operation
|
The operation to validate.
|
Raises |
ValueError
|
The operation isn't valid for this device.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-06-27 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-06-27 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-27 UTC."],[],[]]