class_docstr: Writes `Event` protocol buffers to an event file. This class is ported from
  EventsWriter defined in
  https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/util/events_writer.cc
class_docstr_tok: ["Writes","`","Event","`","protocol","buffers","to","an","event","file",".","This","class","is","ported","from","EventsWriter","defined","in","https",":","\/\/github.com\/tensorflow\/tensorflow\/blob\/master\/tensorflow\/core\/util\/events_writer.cc"]
code: def _init_if_needed(self):
      if self._recordio_writer is not None:
          return
      self._filename = (
          self._file_prefix
          + ".out.tfevents."
          + str(time.time())[:10]
          + "."
          + socket.gethostname()
          + self._file_suffix
      )
      self._recordio_writer = RecordWriter(self._filename)
      if self._logger is not None:
          self._logger.info(
              "successfully opened events file: %s", self._filename
          )
      event = event_pb2.Event()
      event.wall_time = time.time()
      self.write_event(event)
      self.flush()
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import logging
  import os.path
  import socket
  import threading
  import time
  import six
  from .proto import event_pb2
  from .record_writer import RecordWriter
label_desc: Use image node_id 3 for calling the EventsWriter obj's underlying member method code with example usage: obj._init_if_needed() without return types