Note: This is mainly designed for TensorFlow 1; the logging API in TensorFlow 2 is significantly easier than in TensorFlow 1. This module is compatible with TensorFlow 2, but some features may not work with eager execution.
Are you prototyping something and want to be able to magically graph some value without going through all the usual steps to set up TensorFlow logging properly?
easy_tf_log is a simple module to do just that.
from easy_tf_log import tflog
then you can do
for i in range(10): tflog('really_interesting_variable_name', i)
and you'll find a directory
logs that you can point TensorBoard to
$ tensorboard --logdir logs
demo.py for a full demo.
Based on logging code from OpenAI's baselines.
pip install easy-tf-log
Note that TensorFlow must be installed separately.
easy-tf-log supports logging using either a global logger or an instantiated logger object.
The global logger is good for very quick prototypes, but for anything more complicated,
you'll probably want to instantiate your own
easy_tf_log.tflog(key, value, step=None)
value(int or float) under the name
step(int) sets the step associated with
valueexplicitly. If not specified, the step will increment on each call.
log_dircan be an absolute or a relative path.
By default (i.e. if
set_dir is not called), the global logger logs to a
automatically created in the working directory.
logger = easy_tf_log.Logger(log_dir=None, writer=None)
log_dir: an absolute of relative path specifying the directory to log to.
writer: an existing
tf.summary.FileWriterinstance to use for logging.
writerare specified, the logger will log to a
logsdirectory in the working directory. If both are specified, the constructor will raise a
logger.log_key_value(key, value, step=None)
values_list(a list of ints or floats).
value(int or float) changes per second.