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

refactored product to get_product #190

Closed IrwinChay closed 8 months ago

IrwinChay commented 8 months ago

Added get_product()

currently support same scope product, have un-implemented templates for different scope product, the cases written with TODO would need to be discussed (ideally implement them in the actual layers, and keep reparam=self_symb_cfg.reparam in get_product()

The cases without TODO are not urgent and could be ignored for now

Note that to simplify get_product() (avoid too many cases), calling self_layer.get_product() and other_layer.get_product() is different: e.g. if self_layer is input layer and other_layer is product layer, should always call other_layer.get_product(), self_layer.get_product() in this case would raise an error.

Discuss: Could you check if id(cls) and id(CLASS_NAME) are different within the class methods? In my case the memory ids are different, so I only used issubclass(other_symb_cfg.layer_cls, cls). Might be a potential bug?

Discuss how the TODO would be implemented, which are the different cases for different-scope-product we discussed earlier