(hparams, model_dir, output_dir, additional_trial_info)
Writes a tensorboard text summary of the trial.
Writes a tensorboard text summary of the trial.
Writes a tensorboard text summary of the trial .
def _trial_summary(hparams, model_dir, output_dir, additional_trial_info):
  """Writes a tensorboard text summary of the trial."""

  summaries_to_write = collections.OrderedDict()
  summaries_to_write['model_dir'] = model_dir
  summaries_to_write['command_line_args'] = ' \\'.join(sys.argv)

  tf.logging.info('Writing hparams summary: %s', hparams)

  hparams_dict = hparams.values()

  # Create a markdown table from hparams.
  header = '| Key | Value |\n| :--- | :--- |\n'
  keys = sorted(hparams_dict.keys())
  lines = ['| %s | %s |' % (key, str(hparams_dict[key])) for key in keys]
  hparams_table = header + '\n'.join(lines) + '\n'

  summaries_to_write['hparams'] = hparams_table

  summaries_to_write.update(additional_trial_info)

  with tf.Session() as sess:
    writer = tf.summary.FileWriter(output_dir, graph=sess.graph)
    for name, summary in summaries_to_write.items():
      tf.logging.info('Writing summary for %s: %s', name, summary)
      writer.add_summary(
          tf.summary.text(name, tf.constant(summary, name=name),
                          collections=[]).eval())
    writer.close()
def _trial_summary ( hparams , model_dir , output_dir , additional_trial_info ) : summaries_to_write = collections . OrderedDict ( ) summaries_to_write [ 'model_dir' ] = model_dir summaries_to_write [ 'command_line_args' ] = ' \\' . join ( sys . argv ) tf . logging . info ( 'Writing hparams summary: %s' , hparams ) hparams_dict = hparams . values ( ) # Create a markdown table from hparams. header = '| Key | Value |\n| :--- | :--- |\n' keys = sorted ( hparams_dict . keys ( ) ) lines = [ '| %s | %s |' % ( key , str ( hparams_dict [ key ] ) ) for key in keys ] hparams_table = header + '\n' . join ( lines ) + '\n' summaries_to_write [ 'hparams' ] = hparams_table summaries_to_write . update ( additional_trial_info ) with tf . Session ( ) as sess : writer = tf . summary . FileWriter ( output_dir , graph = sess . graph ) for name , summary in summaries_to_write . items ( ) : tf . logging . info ( 'Writing summary for %s: %s' , name , summary ) writer . add_summary ( tf . summary . text ( name , tf . constant ( summary , name = name ) , collections = [ ] ) . eval ( ) ) writer . close ( )