#!/usr/bin/env python # coding: utf-8 # # Adding plugins to your computation stack # # A plugin is a tool which can be link to a QPU to make the computation stack more powerful. A plugin is used to pre-process batches sended to a QPU and/or post-process results of a QPU. # When a Plugin is linked to a QPU, a new QPU is created. For instance, the following code defines a new QPU where each batch sended to this object is pre-processed and each result is post-processed by the plugin "*Plugin()*": # # > `my_qpu = Plugin() | QPU()` # # The QLM provides classes to define your own plugin, an example of custom plugin is presented in [**this tutorial**](plugins.ipynb). # # Moreover, some plugins are already implemented in the QLM: # - [**Quameleon plugin**](./emulating_custom_hardware_specs.ipynb): this plugin is used to simulate hardware specs for any QPU # - the [**observable splitter plugin**](./observable_splitter.ipynb) can be used to tranform observable sampling into computational basis sampling # - the [**circuit inliner**](./circuit_inliner.ipynb) can be used to inline the content of a circuit in its main (in case some other Plugin needs to access the inlined circuit) # # Finally, [**this**](./plugins.ipynb) notebook shows how to write your own QLM compatible plugin. # In[ ]: