pyro-ppl / funsor

Functional tensors for probabilistic programming
https://funsor.pyro.ai
Apache License 2.0
236 stars 20 forks source link

Dispatch to `Integrate(Delta, ...)` in `normalize_integrate_contraction` #551

Closed ordabayevy closed 3 years ago

ordabayevy commented 3 years ago

Addresses #550 .

pytest contrib/funsor/ tests pass locally:

contrib/funsor/test_enum_funsor.py .........................x...................x.x.....                [ 16%]
contrib/funsor/test_infer_discrete.py ..........................                                        [ 23%]
contrib/funsor/test_named_handlers.py ......                                                            [ 25%]
contrib/funsor/test_pyroapi_funsor.py ................x                                                 [ 30%]
contrib/funsor/test_tmc.py ............................................................................ [ 53%]
............                                                                                            [ 57%]
contrib/funsor/test_valid_models_enum.py ................xxxx....................................       [ 74%]
contrib/funsor/test_valid_models_plate.py ........X.X.X.X................                               [ 83%]
contrib/funsor/test_valid_models_sequential_plate.py .........                                          [ 86%]
contrib/funsor/test_vectorized_markov.py ........................XXXXXXXXXXXX.....x...                  [100%]

============================ 306 passed, 9 xfailed, 16 xpassed in 91.92s (0:01:31) ============================
eb8680 commented 3 years ago

What went wrong with the dice_factor change?

ordabayevy commented 3 years ago

Wasn't sure if it should be in the same PR. There is a change I had to make in the test: remove terms[0] because .sample there now returns just Delta instead of Contraction (result+dice_factor) - hope that doesn't affect the test.