Initialize Logger

Chinese

  • class visualdl.LogWriter(dir, sync_cycle, writer=None)
  • LogWriter is a Python wrapper to write data to log file with the dataformat defined in storage.proto. A User can get Scalar Reader/Image Reader/Histogram Reader from this module and use them to write the data to log file.

Parameters:

  • dir (basestring) – The directory path to the saved log files.
  • sync_cycle (integer) – Specify how often should the system store data into the file system.Typically adding a record requires 6 operations.System will save the data into the file system once operations count reaches sync_cycle.Returns:a new LogWriter instanceReturn type:LogWriter
  • asmode(_mode)
  • create a new LogWriter with mode and return it.

Parameters:mode (basestring) – The logger will group data under mode.Returns:the logWriter itselfReturn type:LogWriter

  • audio(tag, num_samples, step_cycle=1)
  • Create an audio writer that used to write audio data.

Parameters:

  1. - **tag** (_basestring_) The audio writer will label the audio with tag
  2. - **num_samples** (_integer_) how many samples to take in a step.
  3. - **step_cycle** (_integer_) store every _step_cycle_ as a record.Returns:

A audio writer to sample audioReturn type:AudioWriter

  • embedding()
  • Create an embedding writer that is used to writeembedding data.

Returns:An embedding writer to record embedding dataReturn type:embeddingWriter

  • histogram(tag, num_buckets, type='float')
  • Create a histogram writer that used to writehistogram related data.

Parameters:tag (basestring) – The histogram writer will label the data with tagReturns:A histogram writer to record distributionReturn type:HistogramWriter

  • image(tag, num_samples, step_cycle=1)
  • Create an image writer that used to write image data.

Parameters:

  1. - **tag** (_basestring_) The image writer will label the image with tag
  2. - **num_samples** (_integer_) how many samples to take in a step.
  3. - **step_cycle** (_integer_) store every _step_cycle_ as a record.Returns:

A image writer to sample imagesReturn type:ImageWriter

  • mode(mode)
  • Set the current mode of writer.

Parameters:mode (basestring) – The logger will group data under mode.Returns:a new LogWriter instance with modeReturn type:LogWriter

  • save()
  • Force the VisualDL to sync with the file system.

  • scalar(tag, type='float')

  • Create a scalar writer with tag and type to write scalar data.

Parameters:tag (basestring) – The scalar writer will label the data with tagReturns:A scalar writer to handle step and value recordsReturn type:ScalarWriter

  • text(tag)
  • Create a text writer that used to writetext related data.

Parameters:tag (basestring) – The text writer will label the data with tagReturns:A text writer to record distributionReturn type:TextWriter

  • class visualdl.LogReader(dir, reader=None)
  • LogReader is a Python wrapper to read and analysis the data thatsaved with data format defined in storage.proto. A User can getScalar Reader/Image Reader/Histogram Reader from this module and usethem to reade the data you need.

    • asmode(_mode)
    • create a new LogReader with mode and return it to user.

Parameters:mode (basestring) – The log reader will read the data grouped by mode.Returns:a new log reader instanceReturn type:LogReader

  • audio(tag)
  • Get an audio reader with tag

Parameters:tag (basestring) – The reader will read the audio data marked with tag

  • embedding()
  • Get the embedding reader.

  • histogram(tag, type='float')

  • Get a histogram reader with tag and data type

Parameters:tag (basestring) – The reader will read the histogram data marked with tag

  • image(tag)
  • Get a image reader with tag

Parameters:tag (basestring) – The reader will read the image data marked with tag

  • mode(mode)
  • Set the current mode of reader.

Parameters:mode (basestring) – The log reader will read the data grouped by mode.Returns:the log reader itselfReturn type:LogReader

  • modes()
  • Get all modes of the log file

Returns:a list of all modesReturn type:list

  • scalar(tag, type='float')
  • Get a scalar reader with tag and data type

Parameters:tag (basestring) – The reader will read the scalar data marked with tag

  • tags(component)
  • Get all tags from the current log file for one kind of component

Parameters:component – scalar|histogram|imageReturns:all the tagsType:list

  • text(tag)
  • Get a text reader with tag

Parameters:tag (basestring) – The reader will read the text data marked with tag