Skip to content

Recompute properties when setting `MCState.sampler`

Vicentini Filippo requested to merge github/fork/wdphy16/fix_mcstate into master

Created by: wdphy16

When setting a new sampler for a MCState, now we recompute n_samples, n_samples_per_rank, and chain_length according to the new sampler.n_chains, such that n_samples == chain_length * n_chains is ensured, and n_samples is unchanged if possible.

I also wrote more tests in test/variational/test_variational.py::test_n_samples_api and test_variational_mixed.py::test_n_samples_api for both exact and Metropolis samplers. Those tests should pass with MPI (although some other tests in those files still do not).

There are a few other things in MCState to fix, and I would like to apply them one by one in case they would interfere with the tests in bizarre ways.

Merge request reports