JsonLog(output_prefix, mode='write', save_params_every=50, write_every=50, save_params=True, autoflush_cost=0.005)¶
Json Logger, that can be passed with keyword argument logger to Monte Carlo drivers in order to serialize the outpit data of the simulation.
If the model state is serialized, then it is serialized using the msgpack protocol of flax. For more information on how to de-serialize the output, see here. The target of the serialization is the variational state itself.
Data is serialized to json as several nested dictionaries. You can deserialize by simply calling
json.load(open(filename)). Logged expectation values will be captured inside histories objects, so they will have a subfield iter with the iterations at which that quantity has been computed, then Mean and others. Complex numbers are logged as dictionaries
__init__(output_prefix, mode='write', save_params_every=50, write_every=50, save_params=True, autoflush_cost=0.005)¶
Construct a Json Logger.
str) – the name of the output files before the extension
int) – every how many iterations should machine parameters be flushed to file
int) – every how many iterations should data be flushed to file
str) – Specify the behaviour in case the file already exists at this output_prefix. Options are - [w]rite: (default) overwrites file if it already exists; - [a]ppend: appends to the file if it exists, overwise creates a new file; - [x] or fail: fails if file already exists;
bool) – bool flag indicating whever parameters should be serialized
float) – Maximum fraction of runtime that can be dedicated to serializing data. Defaults to 0.005 (0.5 per cent)
The dictionary of logged data.