sbi-benchmark / sbibm

Simulation-based inference benchmark
https://sbi-benchmark.github.io
MIT License
88 stars 34 forks source link

Test for valid use of (S)NPE API #24

Closed psteinb closed 2 years ago

psteinb commented 2 years ago

This PR attempts a solution to #23 without (yet) introducing test categories a la @pytest.mark.slow (see https://github.com/mackelab/sbi/blob/86256e02c1080965795e65062c4ab9d3a19015d2/tests/linearGaussian_snpe_test.py#L196)

psteinb commented 2 years ago

btw, when run, this unit tests results in:

        # For torch < 1.8 log_abs_det_jacobian is returned for each dimension.
        if vals.ndim > 1 and vals.shape[1] == dim_parameters:
            vals = vals.sum(-1)

>       assert (
            vals.numel == batch_size
        ), "Mismatch in batch size, took sum over whole batch?"
E       AssertionError: Mismatch in batch size, took sum over whole batch?

../../sbibm/utils/torch.py:105: AssertionError

which is related to #15 I guess

jan-matthis commented 2 years ago

which is related to #15 I guess

Yes, this is due to #15. @janfb will fix this beginning of next week, that will iron it out

jan-matthis commented 2 years ago

Cheers!