netket.nn.to_array

Contents

netket.nn.to_array#

netket.nn.to_array(hilbert, apply_fun, variables, *, normalize=True, allgather=True, chunk_size=None)[source]#

Computes apply_fun(variables, states) on all states of hilbert and returns the results as a vector.

Parameters:
  • normalize (bool) – If True, the vector is normalized to have L2-norm 1.

  • allgather (bool) – If allgather=True, the final wave function is a fully replicated array. If allgather=False, the final wave function is a sharded array, padded with zeros to the next multiple of the number of devices.

  • chunk_size (int | None) – Optional integer to specify the largest chunks of samples that the model will be evaluated upon. By default it is None, and when specified samples are split into chunks of at most chunk_size.

  • hilbert (DiscreteHilbert)

  • apply_fun (Callable[[Any, ndarray | Array], ndarray | Array])

  • variables (Any)

Returns:

The computed array.

Return type:

Array