parameters: (output_dir,
                             dictionary,
                             current_global_step)
docstring: Writes a `dict` into summary file in given output directory.
  
    Args:
      output_dir: `str`, directory to write the summary file in.
      dictionary: the `dict` to be written to summary file.
      current_global_step: `int`, the current global step.
docstring_summary: Writes a `dict` into summary file in given output directory.
docstring_tokens: Writes a dict into summary file in given output directory .
function: def _write_dict_to_summary(output_dir,
                             dictionary,
                             current_global_step):
    """Writes a `dict` into summary file in given output directory.
  
    Args:
      output_dir: `str`, directory to write the summary file in.
      dictionary: the `dict` to be written to summary file.
      current_global_step: `int`, the current global step.
    """
    logging.info('Saving dict for global step %d: %s', current_global_step,
                 _dict_to_str(dictionary))
    summary_writer = writer_cache.FileWriterCache.get(output_dir)
    summary_proto = summary_pb2.Summary()
    for key in dictionary:
      if dictionary[key] is None:
        continue
      if key == 'global_step':
        continue
      value = summary_proto.value.add()
      value.tag = key
      if (isinstance(dictionary[key], np.float32) or
          isinstance(dictionary[key], float)):
        value.simple_value = float(dictionary[key])
      elif (isinstance(dictionary[key], np.int64) or
            isinstance(dictionary[key], np.int32) or
            isinstance(dictionary[key], int)):
        value.simple_value = int(dictionary[key])
      else:
        logging.warn(
            'Skipping summary for %s, must be a float, np.float32, np.int64, '
            'np.int32 or int.',
            key)
    summary_writer.add_summary(summary_proto, current_global_step)
    summary_writer.flush()
function_tokens: def _write_dict_to_summary ( output_dir , dictionary , current_global_step ) : logging . info ( 'Saving dict for global step %d: %s' , current_global_step , _dict_to_str ( dictionary ) ) summary_writer = writer_cache . FileWriterCache . get ( output_dir ) summary_proto = summary_pb2 . Summary ( ) for key in dictionary : if dictionary [ key ] is None : continue if key == 'global_step' : continue value = summary_proto . value . add ( ) value . tag = key if ( isinstance ( dictionary [ key ] , np . float32 ) or isinstance ( dictionary [ key ] , float ) ) : value . simple_value = float ( dictionary [ key ] ) elif ( isinstance ( dictionary [ key ] , np . int64 ) or isinstance ( dictionary [ key ] , np . int32 ) or isinstance ( dictionary [ key ] , int ) ) : value . simple_value = int ( dictionary [ key ] ) else : logging . warn ( 'Skipping summary for %s, must be a float, np.float32, np.int64, ' 'np.int32 or int.' , key ) summary_writer . add_summary ( summary_proto , current_global_step ) summary_writer . flush ( )