A slim tensorflow wrapper that provides syntactic sugar for tensor variables. This library will be helpful for practical deep learning researchers not beginners.
MIT License
372
stars
63
forks
source link
Add tables initializer in the local_init_op of the Supervisor class #35
One of my implementations required usage of tf.contrib.lookup.index_table_from_file which creates a hash table which needs to be initialized before training via tf.tables_initializer(). The place to do this is within the sg_train.py file, where the Supervisor class is created. E.g.:
# console logging function
def console_log(sess_):
if epoch >= 0:
tf.sg_info('\tEpoch[%03d:gs=%d] - loss = %s' %
(epoch, sess_.run(tf.sg_global_step()),
('NA' if loss is None else '%8.6f' % loss)))
local_init_op = tf.group(tf.sg_phase().assign(True), tf.tables_initializer())
# create supervisor
sv = tf.train.Supervisor(logdir=opt.save_dir,
saver=saver,
save_model_secs=opt.save_interval,
summary_writer=summary_writer,
save_summaries_secs=opt.log_interval,
global_step=tf.sg_global_step(),
local_init_op=local_init_op)
One of my implementations required usage of
tf.contrib.lookup.index_table_from_file
which creates a hash table which needs to be initialized before training viatf.tables_initializer()
. The place to do this is within the sg_train.py file, where the Supervisor class is created. E.g.: