Emulator
- class braket.emulation.emulator.Emulator(backend, noise_model=None, passes=None, **kwargs)[source]
Bases:
DeviceAn emulator is a simulation device that more closely resembles the capabilities and constraints of a real device or of a specific device model.
- Parameters:
backend (Device) – The backend device to use for emulation.
noise_model (NoiseModel | None) – A noise model to apply to the emulated circuits. Defaults to None.
passes (Iterable[ValidationPass] | None) – A list of validation passes to apply to the emulated circuits. Defaults to None.
Initializes a
Device.- Parameters:
name (str) – Name of quantum device
status (str) – Status of quantum device
backend (
Device)noise_model (
NoiseModel|None)passes (
Iterable[ValidationPass] |None)
- run(task_specification, shots=0, inputs=None, *args, **kwargs)[source]
Emulate a quantum task specification on this quantum device emulator.
A quantum task can be a circuit or an annealing problem. Emulation involves running all emulator passes on the input program before running the program on the emulator’s backend.
- Parameters:
task_specification (TaskSpecification) – Specification of a quantum task to run on device.
shots (int | None) – The number of times to run the quantum task on the device. Default is
None.inputs (dict[str, float] | None) – Inputs to be passed along with the IR. If IR is an OpenQASM Program, the inputs will be updated with this value. Not all devices and IR formats support inputs. Default: {}.
args (
Any)kwargs (
Any)
- Return type:
- Returns:
QuantumTask – The QuantumTask tracking task execution on this device emulator.
- run_batch(task_specifications, shots, max_parallel, inputs, *args, **kwargs)[source]
Executes a batch of quantum tasks in parallel
- Parameters:
task_specifications (TaskSpecification | list[TaskSpecification]) – Single instance or list of circuits or problems to run on device.
shots (int | None) – The number of times to run the circuit or annealing problem.
max_parallel (int | None) – The maximum number of quantum tasks to run in parallel. Batch creation will fail if this value is greater than the maximum allowed concurrent quantum tasks on the device.
inputs (dict[str, float] | list[dict[str, float]] | None) – Inputs to be passed along with the IR. If the IR supports inputs, the inputs will be updated with this value.
*args (Any) – Arbitrary arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
QuantumTaskBatch – A batch containing all of the qauntum tasks run
- property noise_model: NoiseModel
An emulator may be defined with a quantum noise model which mimics the noise on a physical device. A quantum noise model can be defined using the NoiseModel class. The noise model is applied to Braket Circuits before running them on the emulator backend.
- Returns:
NoiseModel – This emulator’s noise model.
- transform(task_specification, apply_noise_model=True)[source]
Passes the input program through all Pass objects contained in this emulator and applies the emulator’s noise model, if it exists, before returning the compiled program.
- Parameters:
task_specification (TaskSpecification) – The input program to validate and compile based on this emulator’s Passes
apply_noise_model (bool) – If true, apply this emulator’s noise model to the compiled program before returning the final program.
- Return type:
Circuit|SerializableProgram|ProgramSet|Program|ProgramSet|AnalogHamiltonianSimulation|PulseSequence- Returns:
TaskSpecification – A compiled program with a noise model applied, if one exists for this emulator and apply_noise_model is true.