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

`reset_parameters` in the product circuit will overwrite the original weights #184

Closed lkct closed 8 months ago

lkct commented 9 months ago

As per title. If we put circuit1.product(circuit2) after calling the forward functions, the answer will be wrong. This indicates bugs in the param init code flow.

https://github.com/april-tools/cirkit/blob/a3792cbb7c7ae0dd30823f861a4729f51faac0a5/tests/new/model/functional/test_product.py#L14-L18

lkct commented 8 months ago

Discussed with @loreloc on Friday. Bottom line is:

  1. Make life easier for starting users, who are expected to rely mostly on pre-defined things. We should have some default behaviour, which may not cover all corner cases but should be "correct" out of the box.
  2. Advanced users are expected to learn how the lib works. There can be not-starter-facing cases without well-defined default, and the user should be responsible for specifying a "safe" behaviour they want.

(We may improve safety checks later but it will be of lower priority -- we make everything work first)