{-# LANGUAGE Rank2Types #-}
module TensorFlow.Records.Conduit
(
encodeTFRecords
, decodeTFRecords
, sinkTFRecords
, sourceTFRecords
) where
import Control.Monad.Catch (MonadThrow)
import Control.Monad.Trans.Resource (MonadResource)
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as BL
import Data.Conduit ((.|), ConduitT)
import Data.Conduit.Binary (sinkFile, sourceFile)
import Data.Conduit.Cereal (conduitGet2, conduitPut)
import TensorFlow.Records (getTFRecord, putTFRecord)
decodeTFRecords :: MonadThrow m => ConduitT B.ByteString BL.ByteString m ()
decodeTFRecords :: ConduitT ByteString ByteString m ()
decodeTFRecords = Get ByteString -> ConduitT ByteString ByteString m ()
forall (m :: * -> *) o.
MonadThrow m =>
Get o -> ConduitT ByteString o m ()
conduitGet2 Get ByteString
getTFRecord
sourceTFRecords :: (MonadResource m, MonadThrow m) => FilePath -> ConduitT i BL.ByteString m ()
sourceTFRecords :: FilePath -> ConduitT i ByteString m ()
sourceTFRecords path :: FilePath
path = FilePath -> ConduitT i ByteString m ()
forall (m :: * -> *) i.
MonadResource m =>
FilePath -> ConduitT i ByteString m ()
sourceFile FilePath
path ConduitT i ByteString m ()
-> ConduitM ByteString ByteString m ()
-> ConduitT i ByteString m ()
forall (m :: * -> *) a b c r.
Monad m =>
ConduitM a b m () -> ConduitM b c m r -> ConduitM a c m r
.| ConduitM ByteString ByteString m ()
forall (m :: * -> *).
MonadThrow m =>
ConduitT ByteString ByteString m ()
decodeTFRecords
encodeTFRecords :: Monad m => ConduitT BL.ByteString B.ByteString m ()
encodeTFRecords :: ConduitT ByteString ByteString m ()
encodeTFRecords = Putter ByteString -> ConduitT ByteString ByteString m ()
forall (m :: * -> *) a.
Monad m =>
Putter a -> ConduitT a ByteString m ()
conduitPut Putter ByteString
putTFRecord
sinkTFRecords :: (MonadResource m) => FilePath -> ConduitT BL.ByteString o m ()
sinkTFRecords :: FilePath -> ConduitT ByteString o m ()
sinkTFRecords path :: FilePath
path = ConduitT ByteString ByteString m ()
forall (m :: * -> *).
Monad m =>
ConduitT ByteString ByteString m ()
encodeTFRecords ConduitT ByteString ByteString m ()
-> ConduitM ByteString o m () -> ConduitT ByteString o m ()
forall (m :: * -> *) a b c r.
Monad m =>
ConduitM a b m () -> ConduitM b c m r -> ConduitM a c m r
.| FilePath -> ConduitM ByteString o m ()
forall (m :: * -> *) o.
MonadResource m =>
FilePath -> ConduitT ByteString o m ()
sinkFile FilePath
path