Struct tfrecord::summary::EventWriter [−][src]
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
impl<W> EventWriter<W> where
W: Write,
[src]
W: Write,
pub fn write_scalar<T>(
&mut self,
tag: T,
event_init: impl Into<EventInit>,
value: f32
) -> Result<(), Error> where
T: ToString,
[src]
&mut self,
tag: T,
event_init: impl Into<EventInit>,
value: f32
) -> Result<(), Error> where
T: ToString,
Write a scalar summary.
pub fn write_histogram<T, H, E>(
&mut self,
tag: T,
event_init: impl Into<EventInit>,
histogram: H
) -> Result<(), Error> where
T: ToString,
H: TryInto<HistogramProto, Error = E>,
Error: From<E>,
[src]
&mut self,
tag: T,
event_init: impl Into<EventInit>,
histogram: H
) -> Result<(), Error> where
T: ToString,
H: TryInto<HistogramProto, Error = E>,
Error: From<E>,
Write a histogram summary.
pub fn write_tensor<T, S, E>(
&mut self,
tag: T,
event_init: impl Into<EventInit>,
tensor: S
) -> Result<(), Error> where
T: ToString,
S: TryInto<TensorProto, Error = E>,
Error: From<E>,
[src]
&mut self,
tag: T,
event_init: impl Into<EventInit>,
tensor: S
) -> Result<(), Error> where
T: ToString,
S: TryInto<TensorProto, Error = E>,
Error: From<E>,
Write a tensor summary.
pub fn write_image<T, M, E>(
&mut self,
tag: T,
event_init: impl Into<EventInit>,
image: M
) -> Result<(), Error> where
T: ToString,
M: TryInto<Image, Error = E>,
Error: From<E>,
[src]
&mut self,
tag: T,
event_init: impl Into<EventInit>,
image: M
) -> Result<(), Error> where
T: ToString,
M: TryInto<Image, Error = E>,
Error: From<E>,
Write an image summary.
pub fn write_image_list<T, V, E>(
&mut self,
tag: T,
event_init: impl Into<EventInit>,
images: V
) -> Result<(), Error> where
T: ToString,
V: TryInfoImageList<Error = E>,
Error: From<E>,
[src]
&mut self,
tag: T,
event_init: impl Into<EventInit>,
images: V
) -> Result<(), Error> where
T: ToString,
V: TryInfoImageList<Error = E>,
Error: From<E>,
Write a summary with multiple images.
pub fn write_audio<T, A, E>(
&mut self,
tag: T,
event_init: impl Into<EventInit>,
audio: A
) -> Result<(), Error> where
T: ToString,
A: TryInto<Audio, Error = E>,
Error: From<E>,
[src]
&mut self,
tag: T,
event_init: impl Into<EventInit>,
audio: A
) -> Result<(), Error> where
T: ToString,
A: TryInto<Audio, Error = E>,
Error: From<E>,
Write an audio summary.
pub fn write_event(&mut self, event: Event) -> Result<(), Error>
[src]
Write a custom event.
pub fn flush(&mut self) -> Result<(), Error>
[src]
Flush this output stream.
impl<W> EventWriter<W> where
W: AsyncWriteExt + Unpin,
[src]
W: AsyncWriteExt + Unpin,
pub async fn write_scalar_async<T>(
&mut self,
tag: T,
event_init: impl Into<EventInit>,
value: f32
) -> Result<(), Error> where
T: ToString,
[src]
&mut self,
tag: T,
event_init: impl Into<EventInit>,
value: f32
) -> Result<(), Error> where
T: ToString,
Write a scalar summary asynchronously.
pub async fn write_histogram_async<T, H, E>(
&mut self,
tag: T,
event_init: impl Into<EventInit>,
histogram: H
) -> Result<(), Error> where
T: ToString,
H: TryInto<HistogramProto, Error = E>,
Error: From<E>,
[src]
&mut self,
tag: T,
event_init: impl Into<EventInit>,
histogram: H
) -> Result<(), Error> where
T: ToString,
H: TryInto<HistogramProto, Error = E>,
Error: From<E>,
Write a histogram summary asynchronously.
pub async fn write_tensor_async<T, S, E>(
&mut self,
tag: T,
event_init: impl Into<EventInit>,
tensor: S
) -> Result<(), Error> where
T: ToString,
S: TryInto<TensorProto, Error = E>,
Error: From<E>,
[src]
&mut self,
tag: T,
event_init: impl Into<EventInit>,
tensor: S
) -> Result<(), Error> where
T: ToString,
S: TryInto<TensorProto, Error = E>,
Error: From<E>,
Write a tensor summary asynchronously.
pub async fn write_image_async<T, M, E>(
&mut self,
tag: T,
event_init: impl Into<EventInit>,
image: M
) -> Result<(), Error> where
T: ToString,
M: TryInto<Image, Error = E>,
Error: From<E>,
[src]
&mut self,
tag: T,
event_init: impl Into<EventInit>,
image: M
) -> Result<(), Error> where
T: ToString,
M: TryInto<Image, Error = E>,
Error: From<E>,
Write an image summary asynchronously.
pub async fn write_image_list_async<T, V, E>(
&mut self,
tag: T,
event_init: impl Into<EventInit>,
images: V
) -> Result<(), Error> where
T: ToString,
V: TryInfoImageList<Error = E>,
Error: From<E>,
[src]
&mut self,
tag: T,
event_init: impl Into<EventInit>,
images: V
) -> Result<(), Error> where
T: ToString,
V: TryInfoImageList<Error = E>,
Error: From<E>,
Write a summary with multiple images asynchronously.
pub async fn write_audio_async<T, A, E>(
&mut self,
tag: T,
event_init: impl Into<EventInit>,
audio: A
) -> Result<(), Error> where
T: ToString,
A: TryInto<Audio, Error = E>,
Error: From<E>,
[src]
&mut self,
tag: T,
event_init: impl Into<EventInit>,
audio: A
) -> Result<(), Error> where
T: ToString,
A: TryInto<Audio, Error = E>,
Error: From<E>,
Write an audio summary asynchronously.
pub async fn write_event_async(&mut self, event: Event) -> Result<(), Error>
[src]
Write a custom event asynchronously.
pub async fn flush_async(&mut self) -> Result<(), Error>
[src]
Flush this output stream asynchronously.
Trait Implementations
impl<W: Clone> Clone for EventWriter<W>
[src]
fn clone(&self) -> EventWriter<W>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<W: Debug> Debug for EventWriter<W>
[src]
impl<W: PartialEq> PartialEq<EventWriter<W>> for EventWriter<W>
[src]
fn eq(&self, other: &EventWriter<W>) -> bool
[src]
fn ne(&self, other: &EventWriter<W>) -> bool
[src]
impl<W> StructuralPartialEq for EventWriter<W>
[src]
Auto Trait Implementations
impl<W> RefUnwindSafe for EventWriter<W> where
W: RefUnwindSafe,
W: RefUnwindSafe,
impl<W> Send for EventWriter<W> where
W: Send,
W: Send,
impl<W> Sync for EventWriter<W> where
W: Sync,
W: Sync,
impl<W> Unpin for EventWriter<W> where
W: Unpin,
W: Unpin,
impl<W> UnwindSafe for EventWriter<W> where
W: UnwindSafe,
W: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,