april-tools / cirkit

a python framework to build, learn and reason about probabilistic circuits and tensor networks
https://cirkit-docs.readthedocs.io/en/latest/
GNU General Public License v3.0
71 stars 1 forks source link

Refactor current parameterizations as to have a DAG #226

Closed loreloc closed 4 months ago

loreloc commented 4 months ago

Instead of implementing the parameterizations of layers in a composite way, we can explicitly define a computational graph akin to the current circuit graph.

The main reasons for doing so are the following: I. We can have a generic TorchGraph implementation that is subclasses by both circuit and parameterizations. In this way, we need to implement the optimizer for both computational graphs just once. See #225 for details. II. We have a better representation for the parameterizations, which can speed up both operations and the compilation over large circuits. E.g., by already representing it in terms of the topological ordering of its computational nodes.