qml.device

device(name, wires=1, *args, **kwargs)[source]

Load a plugin Device and return the instance.

This function is used to load a particular quantum device, which can then be used to construct QNodes.

PennyLane comes with support for the following two devices:

  • 'default.qubit': a simple pure state simulator of qubit-based quantum circuit architectures.

  • 'default.gaussian': a simple simulator of Gaussian states and operations on continuous-variable circuit architectures.

In addition, additional devices are supported through plugins — see the available plugins for more details.

All devices must be loaded by specifying their short-name as listed above, followed by the number of wires (subsystems) you wish to initialize.

Some devices may accept additional arguments. For instance, default.gaussian accepts the keyword argument hbar, to set the convention used in the commutation relation \([\x,\p]=i\hbar\) (by default set to 2).

Please refer to the documentation for the individual devices to see any additional arguments that might be required or supported.

Parameters
  • name (str) – the name of the device to load

  • wires (int) – the number of wires (subsystems) to initialise the device with

Keyword Arguments

config (pennylane.Configuration) – a PennyLane configuration object that contains global and/or device specific configurations.