netket.logging.TensorBoardLog#
- class netket.logging.TensorBoardLog[source]#
Bases:
AbstractLog
Creates a tensorboard logger using tensorboardX’s summarywriter.
Refer to its documentation for further details
https://tensorboardx.readthedocs.io/en/latest/tensorboard.html
TensorBoardX must be installed.
- Parameters:
logdir (
string
) – Save directory location. Default is runs/CURRENT_DATETIME_HOSTNAME, which changes after each run. Use hierarchical folder structure to compare between runs easily. e.g. pass in ‘runs/exp1’, ‘runs/exp2’, etc. for each new experiment to compare across them.comment (
string
) – Comment logdir suffix appended to the defaultlogdir
. Iflogdir
is assigned, this argument has no effect.purge_step (
int
) – When logging crashes at step \(T+X\) and restarts at step \(T\), any events whose global_step larger or equal to \(T\) will be purged and hidden from TensorBoard. Note that crashed and resumed experiments should have the samelogdir
.max_queue (
int
) – Size of the queue for pending events and summaries before one of the ‘add’ calls forces a flush to disk. Default is ten items.flush_secs (
int
) – How often, in seconds, to flush the pending events and summaries to disk. Default is every two minutes.filename_suffix (
string
) – Suffix added to all event filenames in the logdir directory. More details on filename construction in tensorboard.summary.writer.event_file_writer.EventFileWriter.write_to_disk (
boolean
) – If pass False, TensorBoardLog will not write to disk.
Examples
Logging optimisation to tensorboard.
>>> import pytest; pytest.skip("skip automated test of this docstring") >>> >>> import netket as nk >>> # create a summary writer with automatically generated folder name. >>> writer = nk.logging.TensorBoardLog() >>> # folder location: runs/May04_22-14-54_s-MacBook-Pro.local/ >>> # create a summary writer using the specified folder name. >>> writer = nk.logging.TensorBoardLog("my_experiment") >>> # folder location: my_experiment >>> # create a summary writer with comment appended. >>> writer = nk.logging.TensorBoardLog(comment="LR_0.1_BATCH_16") >>> # folder location: runs/May04_22-14-54_s-MacBook-Pro.localLR_0.1_BATCH_16/
- Inheritance
- Methods
- __call__(step, item, variational_state=None)[source]#
Logs at a given integer step a dictionary of data, optionally specifying a variational state to encode additional data.
- Parameters:
step (
int
) – monotonically increasing integer representing the row in the database corresponding to this log entry;item (
dict
[str
,Any
]) – Any dictionary of data to be logged;variational_state (
VariationalState
|None
) – optional variational state from which additional data might be extracted.