Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
- data EventWriter
- withEventWriter :: (MonadIO m, MonadMask m) => FilePath -> (EventWriter -> m a) -> m a
- logEvent :: MonadIO m => EventWriter -> Event -> m ()
- logGraph :: MonadIO m => EventWriter -> Build a -> m ()
- logSummary :: MonadIO m => EventWriter -> Int64 -> Summary -> m ()
- type SummaryTensor = Tensor Value ByteString
- histogramSummary :: (MonadBuild m, TensorType t, t /= ByteString, t /= Bool) => ByteString -> Tensor v t -> m ()
- scalarSummary :: (TensorType t, t /= ByteString, t /= Bool, MonadBuild m) => ByteString -> Tensor v t -> m ()
- mergeAllSummaries :: MonadBuild m => m SummaryTensor
Documentation
data EventWriter Source #
Handle for logging TensorBoard events safely from multiple threads.
:: (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.
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.
scalarSummary :: (TensorType t, t /= ByteString, t /= Bool, MonadBuild m) => ByteString -> Tensor v t -> m () Source #
Adds a scalarSummary
node.
mergeAllSummaries :: MonadBuild m => m SummaryTensor Source #
Merge all summaries accumulated in the Build
into one summary.