mirror of
https://github.com/tensorflow/haskell.git
synced 2024-11-14 15:09:43 +01:00
67 lines
2.5 KiB
Text
67 lines
2.5 KiB
Text
-- Hoogle documentation, generated by Haddock
|
|
-- See Hoogle, http://www.haskell.org/hoogle/
|
|
|
|
|
|
-- | TensorBoard related functionality.
|
|
--
|
|
-- Please see README.md
|
|
@package tensorflow-logging
|
|
@version 0.2.0.0
|
|
|
|
|
|
-- | TensorBoard Summary generation. Provides type safe wrappers around raw
|
|
-- string emitting CoreOps.
|
|
--
|
|
-- Example use:
|
|
--
|
|
-- <pre>
|
|
-- -- 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
|
|
-- </pre>
|
|
module TensorFlow.Logging
|
|
|
|
-- | Handle for logging TensorBoard events safely from multiple threads.
|
|
data EventWriter
|
|
|
|
-- | Writes Event protocol buffers to event files.
|
|
withEventWriter :: (MonadIO m, MonadMask m) => FilePath -> (EventWriter -> m a) -> m a
|
|
|
|
-- | Logs the given Event protocol buffer.
|
|
logEvent :: MonadIO m => EventWriter -> Event -> m ()
|
|
|
|
-- | Logs the graph for the given <a>Build</a> action.
|
|
logGraph :: MonadIO m => EventWriter -> Build a -> m ()
|
|
|
|
-- | Logs the given Summary event with an optional global step (use 0 if
|
|
-- not applicable).
|
|
logSummary :: MonadIO m => EventWriter -> Int64 -> Summary -> m ()
|
|
|
|
-- | Synonym for the tensors that return serialized Summary proto.
|
|
type SummaryTensor = Tensor Value ByteString
|
|
|
|
-- | Adds a <a>histogramSummary</a> node. The tag argument is intentionally
|
|
-- limited to a single value for simplicity.
|
|
histogramSummary :: (MonadBuild m, TensorType t, t /= ByteString, t /= Bool) => ByteString -> Tensor v t -> m ()
|
|
|
|
-- | Adds a <a>imageSummary</a> 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 ()
|
|
|
|
-- | Adds a <a>scalarSummary</a> node.
|
|
scalarSummary :: (TensorType t, t /= ByteString, t /= Bool, MonadBuild m) => ByteString -> Tensor v t -> m ()
|
|
|
|
-- | Merge all summaries accumulated in the <a>Build</a> into one summary.
|
|
mergeAllSummaries :: MonadBuild m => m SummaryTensor
|