Serialization

Qadence offers convenience functions for serializing and deserializing any quantum program. This is useful for storing quantum programs and sending them for execution over the network via an API.

Note

Qadence currently uses a custom JSON serialization as interchange format. Support for QASM format for digital quantum programs is currently under consideration.

  • serialize/deserialize: serialize and deserialize a Qadence object into a dictionary
  • save/load: save and load a Qadence object to a file with one of the supported formats. Currently, these are .json and the PyTorch-compatible .pt format.

Let's start with serialization into a dictionary.

Finally, we can save the quantum circuit and the model with the two supported formats.