tensorflow-logging-0.1.0.0: 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

Handle for logging TensorBoard events safely from multiple threads.

withEventWriter

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 ()

Logs the given Event protocol buffer.

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

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 ()

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

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

Adds a scalarSummary node.

mergeAllSummaries :: MonadBuild m => m SummaryTensor

Merge all summaries accumulated in the Build into one summary.