Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement loading/saving of circuits and pipelines of circuits #250

Open
loreloc opened this issue Jul 30, 2024 · 0 comments
Open

Implement loading/saving of circuits and pipelines of circuits #250

loreloc opened this issue Jul 30, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@loreloc
Copy link
Member

loreloc commented Jul 30, 2024

As per title.

Possible idea to implement this:

  • Ideally, we would like to save circuits in a way such that they can be reloaded on the same backend they were built on, but also different backends and with possibly different compilation flags. In other words, we would like circuits to exist and to be shared regardless of their implementation in some backend. A way to do so is having a general file format to represent circuits.
  • A candidate format can be the one of symbolic circuits we already have. If we construct and learn a circuit on some specific backend, we can then save it by (1) copying the symbolic circuit we started from, and (2) by replacing the symbolic tensor parameters with new symbolic parameters having a ConstantTensorInitializer as initializer. The initialization tensors are then just Numpy arrays, which contain the learned parameters. When we reload a symbolic circuit, these parameters will be then copied during compilation, thus effectively loading them regardless of the chosen backend and compilation flags.
  • If we wish to allow the user to save pipelines, we can do so by simply saving (1) the symbolic circuit entry points of the pipeline, and (2) the operations over these circuits using some super simple language (e.g., a sequence of dest <- op(src_1, ..., src_k) entries). By loading the entry points, one can then recover all the circuits in the pipeline by applying operations and through recompilation.
@loreloc loreloc added the enhancement New feature or request label Jul 30, 2024
@loreloc loreloc added this to the Cirkit 1.0.0 milestone Jul 30, 2024
@loreloc loreloc closed this as completed Sep 17, 2024
@loreloc loreloc reopened this Sep 17, 2024
@loreloc loreloc removed this from the Cirkit 0.1.0 milestone Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant