Initialize Logger

class visualdl.LogWriter(dir, sync_cycle, writer=None)

LogWriter is a Python wrapper to write data to log file with the data format 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 instance

Return type:

LogWriter

as_mode(mode)

create a new LogWriter with mode and return it.

Parameters:mode (basestring) – The logger will group data under mode.
Returns:the logWriter itself
Return type:LogWriter
audio(tag, num_samples, step_cycle=1)

Create an audio writer that used to write audio data.

Parameters:
  • tag (basestring) – The audio writer will label the audio with tag
  • num_samples (integer) – how many samples to take in a step.
  • step_cycle (integer) – store every step_cycle as a record.
Returns:

A audio writer to sample audio

Return type:

AudioWriter

embedding()

Create an embedding writer that is used to write embedding data.

Returns:An embedding writer to record embedding data
Return type:embeddingWriter
histogram(tag, num_buckets, type='float')

Create a histogram writer that used to write histogram related data.

Parameters:tag (basestring) – The histogram writer will label the data with tag
Returns:A histogram writer to record distribution
Return type:HistogramWriter
image(tag, num_samples, step_cycle=1)

Create an image writer that used to write image data.

Parameters:
  • tag (basestring) – The image writer will label the image with tag
  • num_samples (integer) – how many samples to take in a step.
  • step_cycle (integer) – store every step_cycle as a record.
Returns:

A image writer to sample images

Return 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 mode
Return 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 tag
Returns:A scalar writer to handle step and value records
Return type:ScalarWriter
text(tag)

Create a text writer that used to write text related data.

Parameters:tag (basestring) – The text writer will label the data with tag
Returns:A text writer to record distribution
Return type:TextWriter
class visualdl.LogReader(dir, reader=None)

LogReader is a Python wrapper to read and analysis the data that saved with data format defined in storage.proto. A User can get Scalar Reader/Image Reader/Histogram Reader from this module and use them to reade the data you need.

as_mode(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 instance
Return 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 itself
Return type:LogReader
modes()

Get all modes of the log file

Returns:a list of all modes
Return 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|image
Returns:all the tags
Type:list
text(tag)

Get a text reader with tag

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