netket.sampler.sampler_state(sampler, machine, parameters)ΒΆ

Creates the structure holding the state of the sampler.

If you want reproducible samples, you should specify seed, otherwise the state will be initialised randomly.

If running across several MPI processes, all sampler_states are guaranteed to be in a different (but deterministic) state.

This is achieved by first reducing (summing) the seed provided to every MPI rank, then generating n_rank seeds starting from the reduced one, and every rank is initialized with one of those seeds.

  • sampler (Sampler) – The Monte Carlo sampler.

  • machine (Union[Callable, Module]) – a Flax module or callable with the forward pass of the log-pdf.

  • parameters (Any) – The PyTree of parameters of the model.

  • seed – An optional seed or jax PRNGKey. If not specified, a random seed will be used.

Return type



The structure holding the state of the sampler. In general you should not expect it to be in a valid state, and should reset it before use.