TensorBoardWriter

Models & Types · AiDotNet.Logging

Low-level TensorBoard event file writer.

Implements: IDisposable

For Beginners

TensorBoard is a visualization tool from TensorFlow.

This writer creates event files that TensorBoard can read and display. It’s like writing a diary in a specific format that TensorBoard knows how to read and show as beautiful charts and graphs.

Event files contain:

  • Scalar values (loss, accuracy over time)
  • Histograms (weight distributions)
  • Images (sample outputs, feature maps)
  • Text (descriptions, annotations)
  • Graphs (model architecture)

How It Works

TensorBoard event files use a specific binary format consisting of records. Each record contains: length (8 bytes), masked CRC of length (4 bytes), data (variable), and masked CRC of data (4 bytes).

Constructors

Constructor Summary
TensorBoardWriter(string logDir, string filename) Creates a new TensorBoard event file writer.

Properties

Property Summary
string FilePath { get; } Gets the event file path.
string LogDir { get; } Gets the log directory path.

Methods

Method Summary
void Dispose() Releases resources.
void Flush() Flushes pending writes to disk.
void WriteEmbedding(string tag, float[] embeddings, string[] metadata, long step) Writes an embedding with optional metadata and sprite.
void WriteHistogram(string tag, ReadOnlySpan<float> values, long step) Writes a histogram summary from a tensor.
void WriteHistogram(string tag, float[] values, long step) Writes a histogram summary from a tensor.
void WriteImage(string tag, byte[] imageData, int height, int width, long step) Writes an image summary.
void WriteImageRaw(string tag, byte[] pixels, int height, int width, int channels, long step) Writes raw image data (HWC format, values 0-255).
void WriteScalar(string tag, float value, long step) Writes a scalar summary to the event file.
void WriteScalars(string mainTag, Dictionary<string, float> tagValuePairs, long step) Writes multiple scalars as a group.
void WriteText(string tag, string text, long step) Writes text summary.