Struct tfrecord::EventWriter [−][src]
pub struct EventWriter<W> { /* fields omitted */ }
Expand description
The event writer type.
The EventWriter is initialized by EventWriterInit.
It provies a series write_*
methods and write_*_async
asynchronous
analogues to append events to the file recognized by TensorBoard.
The typical usage call the EventWriterInit::from_prefix with the log directory to build a EventWriter.
#![cfg(feature = "full")] use anyhow::Result; use std::time::SystemTime; use tch::{kind::FLOAT_CPU, Tensor}; use tfrecord::EventWriterInit; fn main() -> Result<()> { let mut writer = EventWriterInit::default() .from_prefix("log_dir/myprefix-", None) .unwrap(); // step = 0, scalar = 3.14 writer.write_scalar("my_scalar", 0, 3.14)?; // step = 1, specified wall time, histogram of [1, 2, 3, 4] writer.write_histogram("my_histogram", (1, SystemTime::now()), vec![1, 2, 3, 4])?; // step = 2, specified raw UNIX time in nanoseconds, random tensor of shape [8, 3, 16, 16] writer.write_tensor( "my_tensor", (2, 1.594449514712264e+18), Tensor::randn(&[8, 3, 16, 16], FLOAT_CPU), )?; Ok(()) }
Implementations
Write a scalar summary.
Write a histogram summary.
Write a tensor summary.
Write an image summary.
Write a summary with multiple images.
Write an audio summary.
Write a scalar summary asynchronously.
Write a histogram summary asynchronously.
Write a tensor summary asynchronously.
Write an image summary asynchronously.
Write a summary with multiple images asynchronously.
Write an audio summary asynchronously.
Write a custom event asynchronously.
Flush this output stream asynchronously.
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl<W> RefUnwindSafe for EventWriter<W> where
W: RefUnwindSafe,
impl<W> Send for EventWriter<W> where
W: Send,
impl<W> Sync for EventWriter<W> where
W: Sync,
impl<W> Unpin for EventWriter<W> where
W: Unpin,
impl<W> UnwindSafe for EventWriter<W> where
W: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more