netket.sampler.rules.CustomRuleNumpy¶
-
class
netket.sampler.rules.
CustomRuleNumpy
(operator, weight_list=None)¶ Bases:
netket.sampler.MetropolisRule
- Inheritance
- Attributes
-
weight_list
: Any = None¶
-
- Methods
-
init_state
(sampler, machine, params, key)[source]¶ Initialises the optional internal state of the Metropolis sampler transition rule.
The provided key is unique and does not need to be splitted.
It should return an immutable data structure.
- Parameters
sampler – The Metropolis sampler.
machine – A Flax module with the forward pass of the log-pdf.
params – The PyTree of parameters of the model.
key – A Jax PRNGKey.
- Returns
An optional state.
-
random_state
(sampler, machine, parameters, state, key)¶ Generates a random state compatible with this rule.
By default this calls
netket.hilbert.random.random_state()
.- Parameters
sampler (
MetropolisSampler
) – The Metropolis sampler.machine (
Module
) – A Flax module with the forward pass of the log-pdf.parameters (
Any
) – The PyTree of parameters of the model.state (
SamplerState
) – The current state of the sampler. Should not modify it.key (
Any
) – The PRNGKey to use to generate the random state.
-
replace
(**updates)¶ “Returns a new object replacing the specified fields with new values.
-
reset
(sampler, machine, params, sampler_state)¶ Resets the internal state of the Metropolis Sampler Transition Rule.
- Parameters
sampler (
MetropolisSampler
) – The Metropolis sampler.machine (
Module
) – A Flax module with the forward pass of the log-pdf.params (
Any
) – The PyTree of parameters of the model.sampler_state (
SamplerState
) – The current state of the sampler. Should not modify it.
- Return type
- Returns
A new, resetted, state of the rule. This returns the same type of
sampler_state.rule_state()
and might be None.
-