예제 #1
0
 def add_summary(self, summary, global_step=None):
     '''Add a `Summary` protocol buffer to the event file.'''
     if isinstance(summary, bytes):
         summ = summary_pb2.Summary()
         summ.ParseFromString(summary)
         summary = summ
     event = event_pb2.Event(summary=summary)
     self._add_event(event, global_step)
예제 #2
0
    def __init__(self, file_prefix='events'):
        '''
        Events files have a name of the form
        '/some/file/path/events.out.tfevents.[timestamp].[hostname]'
        '''
        self._path = file_prefix + ".out.tfevents." + \
                            str(time.time())[:10] + \
                            "." + socket.gethostname()

        self._num_outstanding_events = 0

        # X: open up the writer
        self._writer = open(self._path, 'wb')

        # Initialize an event instance.
        self._event = event_pb2.Event()

        # X: get the time
        self._event.wall_time = time.time()

        # write event
        self.write_event(self._event)
예제 #3
0
 def add_graph(self, graph):
     '''Add a `Graph` protocol buffer to the event file.'''
     event = event_pb2.Event(graph_def=graph.SerializeToString())
     self._add_event(event, None)