Batched versions of RbmSpin and MetropolisLocal
Created by: twesterhout
Breaking changes
-
variational
-
compute_samples
returns aMCResult
type instead of_VmcResult
(netket::vmc::Result
in C++).netket::vmc::Result
didn't expose any methods or data members to Python and was just completely useless for end users.MCResult
exposes all the data obtained during sampling. -
compute_samples
argument names changed:nsamples
is nown_samples
andndiscard
is replaced byn_discard
(as requested here). - Number of samples returned from
compute_samples
may differ from the argument value for samplers with batch sizes greater than 1. -
expectation
andvariance
functions are removed. A combination of calls tolocal_values
andstatistics
can be used instead. - Interface of
gradient
function has changed. - Interface of
local_values
function has changed. -
local_value
function is removed.local_values
can be used instead. - Added
statistics
function for calculating means, variances, errors, correlation times, etc. of Monte Carlo data.
-
-
machine
- order of arguments in
init_random_parameters
has changed. Moreover, it is no longer necessary to provide aseed
. Random number generator will be initialised from/dev/random
(or/dev/urandom
). - Machines now have a
state_dict
function which returns internal state as a dictionary (similar totorch.nn.Module.state_dict
in PyTorch). Currently, onlyRbmSpinV2
supports it. All other machines throw errors saying that the requested functionality is not implemented. -
log_val
andder_log
can now receive either 1D or 2D tensors corresponding to a single visible configuration or a batch of visible configurations.
- order of arguments in
-
sampler
-
machine_func
now works with arrays instead of scalars. -
acceptance
is no longer part ofSampler
, but most of the samplers still implement it. -
visible
property is now a 2D tensor and behaves slightly differently. - Removed
hilbert
property. Use.machine.hilbert
instead.
-
-
probably more
Code changes
- Machines are free to use their own custom type for lookup tables. It is passed around using
netket::any
(a C++11 port ofstd::any
). -
AbstractMachine::LogVal
is renamed toLogValSingle
.LogVal
now works with batches of visible configurations.AbstractMachine
contains default implementation forLogVal
in terms ofLogValSingle
. -
AbstractMachine::DerLog
is renamed toDerLogSingle
.DerLog
now works with batches of visible configurations.AbstractMachine
contains default implementation forDerLog
in terms ofDerLogSingle
. -
RbmSpinV2
-- a safer and more efficient version ofRbmSpin
. - Stochastic reconfiguration is now exposed to Python as
SR
. - Samplers now have a
BatchSize
method. - Samplers now have
CurrentState
function which returns both the current visible configuration and the corresponding logarithm of the wavefunction. - etc.
New dependencies
- Sleef vectorized maths library. Currently used only for implementing faster activation function for RBMs. It also has a DFT component which might be useful if at some point we decide to estimate correlation time using lag-t correlations.
-
linb-any implementation of C++17
std::any
for C++11-compatible compilers.