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

Add detailed tests + structural properties implementation #255

Closed loreloc closed 1 month ago

loreloc commented 1 month ago

Current coverage is ~73%.

TorchCircuit(
  (0): TorchCategoricalLayer(
    folds: 5  channels: 1  variables: 1  output-units: 2
    input-shape: (5, 1, -1, 1)
    output-shape: (5, -1, 2)
    (probs): TorchParameter(
      shape: (5, 2, 1, 2)
      (0): TorchTensorParameter(output-shape: (5, 2, 1, 2))
    )
  )
  (1): TorchCPTLayer(
    folds: 2  arity: 2  input-units: 2  output-units: 2
    input-shape: (2, 2, -1, 2)
    output-shape: (2, -1, 2)
    (weight): TorchParameter(
      shape: (2, 2, 2)
      (0): TorchTensorParameter(output-shape: (2, 2, 2))
    )
  )
   ...
)

Bug fixes:

Minor changes:

Closes #213 by refactoring the region graph data structure. Closes #57 as it is not an informative issue and will never be closed. Closes #228 as we now have basic implementations of the structural properties

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 76.56968% with 153 lines in your changes missing coverage. Please review.

Project coverage is 72.27%. Comparing base (faf0c0c) to head (e0859be). Report is 36 commits behind head on main.

Files with missing lines Patch % Lines
cirkit/templates/region_graph/graph.py 77.21% 29 Missing and 7 partials :warning:
cirkit/templates/region_graph/algorithms.py 86.43% 15 Missing and 20 partials :warning:
cirkit/symbolic/circuit.py 64.44% 24 Missing and 8 partials :warning:
cirkit/backend/torch/graph/modules.py 58.18% 22 Missing and 1 partial :warning:
cirkit/symbolic/operators.py 0.00% 4 Missing and 2 partials :warning:
cirkit/backend/torch/compiler.py 54.54% 3 Missing and 2 partials :warning:
cirkit/backend/torch/layers/inner.py 0.00% 2 Missing and 2 partials :warning:
cirkit/symbolic/functional.py 25.00% 1 Missing and 2 partials :warning:
cirkit/backend/torch/graph/folding.py 80.00% 1 Missing and 1 partial :warning:
cirkit/backend/torch/parameters/nodes.py 60.00% 2 Missing :warning:
... and 4 more
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #255 +/- ## ========================================== + Coverage 69.08% 72.27% +3.19% ========================================== Files 53 45 -8 Lines 4392 4426 +34 Branches 594 631 +37 ========================================== + Hits 3034 3199 +165 + Misses 1219 1057 -162 - Partials 139 170 +31 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.