netket.logging.StateLog#

class netket.logging.StateLog[source]#

Bases: AbstractLog

A logger which serializes the variables of the variational state during a run.

The data is saved either to a directory or tar archive in a sequence of files named [0.mpack, 1.mpack, …] where the filename is incremented every time the logger is called. The tar file inside is not flushed to disk (closed) until this object is deleted or python is shut down.

Inheritance
Inheritance diagram of netket.logging.StateLog
__init__(output_prefix, mode='write', save_every=1, tar=False)[source]#

Initialize the StateLogger.

Parameters:
  • output_prefix (str) – the name of the output file before the extension (if tar=True) or of the output folder.

  • save_every (int) – every how many iterations the variables should be saved. (default 1)

  • mode (str) – Specify the behaviour in case the file already exists at this output_prefix. Options are `[w]rite`: (default) overwrites file/delete the folder if it already exists; `[a]ppend`: appends to the file/folder if it exists, otherwise creates a new file; `[x]` or `fail`: fails if file/folder already exists;

  • tar (bool) – if True creates a tar archive instead of a folder.

Methods
__call__(step, item, variational_state)[source]#

Logs at a given integer step a dictionary of data, optionally specifying a variational state to encode additional data.

Parameters:
  • step – monotonically increasing integer representing the row in the database corresponding to this log entry;

  • item – Any dictionary of data to be logged;

  • variational_state – optional variational state from which additional data might be extracted.

close()[source]#
flush(variational_state=None)[source]#

Flushes the data that is stored internally to disk/network.

Parameters:

variational_state – optional variational state from which additional data might be extracted.