tensorflow-logging-0.2.0.1: TensorBoard related functionality.
Safe HaskellNone
LanguageHaskell2010

TensorFlow.Logging

Description

TensorBoard Summary generation. Provides type safe wrappers around raw string emitting CoreOps.

Example use:

-- Call summary functions while constructing the graph.
createModel = do
  loss <- -- ...
  TF.scalarSummary loss

-- Write summaries to an EventWriter.
train = TF.withEventWriter "/path/to/logs" $ \eventWriter -> do
    summaryTensor <- TF.build TF.allSummaries
    forM_ [1..] $ \step -> do
        if (step % 100 == 0)
            then do
                ((), summaryBytes) <- TF.run (trainStep, summaryTensor)
                let summary = decodeMessageOrDie (TF.unScalar summaryBytes)
                TF.logSummary eventWriter step summary
            else TF.run_ trainStep
Synopsis

Documentation

data EventWriter Source #

Handle for logging TensorBoard events safely from multiple threads.

withEventWriter Source #

Arguments

:: (MonadIO m, MonadMask m) 
=> FilePath

logdir. Local filesystem directory where event file will be written.

-> (EventWriter -> m a) 
-> m a 

Writes Event protocol buffers to event files.

logEvent :: MonadIO m => EventWriter -> Event -> m () Source #

Logs the given Event protocol buffer.

logGraph :: MonadIO m => EventWriter -> Build a -> m () Source #

Logs the graph for the given Build action.

logSummary :: MonadIO m => EventWriter -> Int64 -> Summary -> m () Source #

Logs the given Summary event with an optional global step (use 0 if not applicable).

type SummaryTensor = Tensor Value ByteString #

Synonym for the tensors that return serialized Summary proto.

histogramSummary :: (MonadBuild m, TensorType t, t /= ByteString, t /= Bool) => ByteString -> Tensor v t -> m () Source #

Adds a histogramSummary node. The tag argument is intentionally limited to a single value for simplicity.

imageSummary :: (OneOf '[Word8, Word16, Float] t, MonadBuild m) => ByteString -> Tensor v t -> m () Source #

Adds a imageSummary node. The tag argument is intentionally limited to a single value for simplicity.

mergeAllSummaries :: MonadBuild m => m SummaryTensor Source #

Merge all summaries accumulated in the Build into one summary.