mirror of
https://github.com/tensorflow/haskell.git
synced 2024-11-23 11:29:43 +01:00
Adapt to lts-8.6 and use proto-lens-0.2.0.1 (#97)
This commit is contained in:
parent
de16a576da
commit
21b723d542
12 changed files with 23 additions and 22 deletions
|
@ -1,4 +1,4 @@
|
||||||
resolver: lts-6.2
|
resolver: lts-8.6
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
- google-shim
|
- google-shim
|
||||||
|
@ -18,11 +18,12 @@ packages:
|
||||||
|
|
||||||
extra-deps:
|
extra-deps:
|
||||||
# proto-lens is not yet in Stackage.
|
# proto-lens is not yet in Stackage.
|
||||||
- proto-lens-0.1.0.5
|
- proto-lens-0.2.0.1
|
||||||
- proto-lens-protoc-0.1.0.5
|
- proto-lens-protoc-0.2.0.1
|
||||||
- proto-lens-descriptors-0.1.0.5
|
- proto-lens-descriptors-0.2.0.1
|
||||||
- snappy-framing-0.1.1
|
- snappy-framing-0.1.1
|
||||||
- snappy-0.2.0.2
|
- snappy-0.2.0.2
|
||||||
|
- lens-labels-0.1.0.1
|
||||||
|
|
||||||
# Allow our custom Setup.hs scripts to import Data.ProtoLens.Setup from the version of
|
# Allow our custom Setup.hs scripts to import Data.ProtoLens.Setup from the version of
|
||||||
# `proto-lens-protoc` in stack's local DB. See:
|
# `proto-lens-protoc` in stack's local DB. See:
|
||||||
|
|
|
@ -16,7 +16,7 @@ library
|
||||||
build-depends: Cabal >= 1.22 && < 1.25
|
build-depends: Cabal >= 1.22 && < 1.25
|
||||||
, bytestring
|
, bytestring
|
||||||
, directory
|
, directory
|
||||||
, proto-lens == 0.1.*
|
, proto-lens == 0.2.*
|
||||||
, tensorflow-opgen == 0.1.*
|
, tensorflow-opgen == 0.1.*
|
||||||
, tensorflow == 0.1.*
|
, tensorflow == 0.1.*
|
||||||
, base >= 4.7 && < 5
|
, base >= 4.7 && < 5
|
||||||
|
|
|
@ -23,7 +23,7 @@ library
|
||||||
, filepath
|
, filepath
|
||||||
, hostname
|
, hostname
|
||||||
, lens-family
|
, lens-family
|
||||||
, proto-lens == 0.1.*
|
, proto-lens == 0.2.*
|
||||||
, resourcet
|
, resourcet
|
||||||
, stm
|
, stm
|
||||||
, stm-chans
|
, stm-chans
|
||||||
|
|
|
@ -21,7 +21,7 @@ import Data.Default (def)
|
||||||
import Data.List ((\\))
|
import Data.List ((\\))
|
||||||
import Data.ProtoLens (decodeMessageOrDie)
|
import Data.ProtoLens (decodeMessageOrDie)
|
||||||
import Lens.Family2 ((^.), (.~), (&))
|
import Lens.Family2 ((^.), (.~), (&))
|
||||||
import Proto.Tensorflow.Core.Util.Event (fileVersion, step)
|
import Proto.Tensorflow.Core.Util.Event (Event, fileVersion, step)
|
||||||
import System.Directory (getDirectoryContents)
|
import System.Directory (getDirectoryContents)
|
||||||
import System.FilePath ((</>))
|
import System.FilePath ((</>))
|
||||||
import System.IO.Temp (withSystemTempDirectory)
|
import System.IO.Temp (withSystemTempDirectory)
|
||||||
|
@ -43,7 +43,7 @@ testEventWriter :: Test
|
||||||
testEventWriter = testCase "EventWriter" $
|
testEventWriter = testCase "EventWriter" $
|
||||||
withSystemTempDirectory "event_writer_logs" $ \dir -> do
|
withSystemTempDirectory "event_writer_logs" $ \dir -> do
|
||||||
assertEqual "No file before" [] =<< listDirectory dir
|
assertEqual "No file before" [] =<< listDirectory dir
|
||||||
let expected = [ def & step .~ 10
|
let expected = [ (def :: Event) & step .~ 10
|
||||||
, def & step .~ 222
|
, def & step .~ 222
|
||||||
, def & step .~ 8
|
, def & step .~ 8
|
||||||
]
|
]
|
||||||
|
|
|
@ -19,7 +19,7 @@ library
|
||||||
exposed-modules: TensorFlow.Examples.MNIST.Parse
|
exposed-modules: TensorFlow.Examples.MNIST.Parse
|
||||||
, TensorFlow.Examples.MNIST.TrainedGraph
|
, TensorFlow.Examples.MNIST.TrainedGraph
|
||||||
other-modules: Paths_tensorflow_mnist
|
other-modules: Paths_tensorflow_mnist
|
||||||
build-depends: proto-lens == 0.1.*
|
build-depends: proto-lens == 0.2.*
|
||||||
, base >= 4.7 && < 5
|
, base >= 4.7 && < 5
|
||||||
, binary
|
, binary
|
||||||
, bytestring
|
, bytestring
|
||||||
|
|
|
@ -15,7 +15,7 @@ library
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
exposed-modules: TensorFlow.OpGen.ParsedOp
|
exposed-modules: TensorFlow.OpGen.ParsedOp
|
||||||
, TensorFlow.OpGen
|
, TensorFlow.OpGen
|
||||||
build-depends: proto-lens == 0.1.*
|
build-depends: proto-lens == 0.2.*
|
||||||
, tensorflow-proto == 0.1.*
|
, tensorflow-proto == 0.1.*
|
||||||
, base >= 4.7 && < 5
|
, base >= 4.7 && < 5
|
||||||
, bytestring
|
, bytestring
|
||||||
|
|
|
@ -16,7 +16,7 @@ library
|
||||||
exposed-modules: TensorFlow.Gradient
|
exposed-modules: TensorFlow.Gradient
|
||||||
, TensorFlow.Ops
|
, TensorFlow.Ops
|
||||||
, TensorFlow.EmbeddingOps
|
, TensorFlow.EmbeddingOps
|
||||||
build-depends: proto-lens == 0.1.*
|
build-depends: proto-lens == 0.2.*
|
||||||
, base >= 4.7 && < 5
|
, base >= 4.7 && < 5
|
||||||
, bytestring
|
, bytestring
|
||||||
, fgl
|
, fgl
|
||||||
|
|
|
@ -34,8 +34,8 @@ library
|
||||||
, Proto.Tensorflow.Core.Framework.TensorDescription
|
, Proto.Tensorflow.Core.Framework.TensorDescription
|
||||||
, Proto.Tensorflow.Core.Framework.Versions
|
, Proto.Tensorflow.Core.Framework.Versions
|
||||||
, Proto.Tensorflow.Core.Protobuf.Debug
|
, Proto.Tensorflow.Core.Protobuf.Debug
|
||||||
build-depends: proto-lens == 0.1.*
|
build-depends: proto-lens == 0.2.*
|
||||||
, proto-lens-protoc == 0.1.*
|
, proto-lens-protoc == 0.2.*
|
||||||
, base >= 4.7 && < 5
|
, base >= 4.7 && < 5
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
include-dirs: .
|
include-dirs: .
|
||||||
|
|
|
@ -14,7 +14,7 @@ cabal-version: >=1.22
|
||||||
library
|
library
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
exposed-modules: TensorFlow.Queue
|
exposed-modules: TensorFlow.Queue
|
||||||
build-depends: proto-lens == 0.1.*
|
build-depends: proto-lens == 0.2.*
|
||||||
, base >= 4.7 && < 5
|
, base >= 4.7 && < 5
|
||||||
, bytestring
|
, bytestring
|
||||||
, lens-family
|
, lens-family
|
||||||
|
|
|
@ -49,7 +49,7 @@ import Data.Set (Set)
|
||||||
import Data.Text.Encoding (encodeUtf8)
|
import Data.Text.Encoding (encodeUtf8)
|
||||||
import Lens.Family2 (Lens', (^.), (&), (.~))
|
import Lens.Family2 (Lens', (^.), (&), (.~))
|
||||||
import Lens.Family2.Unchecked (lens)
|
import Lens.Family2.Unchecked (lens)
|
||||||
import Proto.Tensorflow.Core.Framework.Graph (node)
|
import Proto.Tensorflow.Core.Framework.Graph (GraphDef, node)
|
||||||
import Proto.Tensorflow.Core.Protobuf.Config (ConfigProto)
|
import Proto.Tensorflow.Core.Protobuf.Config (ConfigProto)
|
||||||
import TensorFlow.Build
|
import TensorFlow.Build
|
||||||
import TensorFlow.Nodes
|
import TensorFlow.Nodes
|
||||||
|
@ -135,7 +135,7 @@ extend = do
|
||||||
trace <- Session (asks tracer)
|
trace <- Session (asks tracer)
|
||||||
nodesToExtend <- build flushNodeBuffer
|
nodesToExtend <- build flushNodeBuffer
|
||||||
unless (null nodesToExtend) $ liftIO $ do
|
unless (null nodesToExtend) $ liftIO $ do
|
||||||
let graphDef = def & node .~ nodesToExtend
|
let graphDef = (def :: GraphDef) & node .~ nodesToExtend
|
||||||
trace ("Session.extend " <> Builder.string8 (showMessage graphDef))
|
trace ("Session.extend " <> Builder.string8 (showMessage graphDef))
|
||||||
FFI.extendGraph session graphDef
|
FFI.extendGraph session graphDef
|
||||||
-- Now that all the nodes are created, run the initializers.
|
-- Now that all the nodes are created, run the initializers.
|
||||||
|
|
|
@ -262,7 +262,7 @@ instance TensorDataType S.Vector Bool where
|
||||||
where
|
where
|
||||||
fromBool x = if x then 1 else 0 :: Word8
|
fromBool x = if x then 1 else 0 :: Word8
|
||||||
|
|
||||||
instance {-# OVERLAPPABLE #-} (Storable a, TensorDataType S.Vector a)
|
instance {-# OVERLAPPABLE #-} (Storable a, TensorDataType S.Vector a, TensorType a)
|
||||||
=> TensorDataType V.Vector a where
|
=> TensorDataType V.Vector a where
|
||||||
decodeTensorData = (S.convert :: S.Vector a -> V.Vector a) . decodeTensorData
|
decodeTensorData = (S.convert :: S.Vector a -> V.Vector a) . decodeTensorData
|
||||||
encodeTensorData x = encodeTensorData x . (S.convert :: V.Vector a -> S.Vector a)
|
encodeTensorData x = encodeTensorData x . (S.convert :: V.Vector a -> S.Vector a)
|
||||||
|
@ -329,7 +329,7 @@ newtype Scalar a = Scalar {unScalar :: a}
|
||||||
deriving (Show, Eq, Ord, Num, Fractional, Floating, Real, RealFloat,
|
deriving (Show, Eq, Ord, Num, Fractional, Floating, Real, RealFloat,
|
||||||
RealFrac, IsString)
|
RealFrac, IsString)
|
||||||
|
|
||||||
instance TensorDataType V.Vector a => TensorDataType Scalar a where
|
instance (TensorDataType V.Vector a, TensorType a) => TensorDataType Scalar a where
|
||||||
decodeTensorData = Scalar . headFromSingleton . decodeTensorData
|
decodeTensorData = Scalar . headFromSingleton . decodeTensorData
|
||||||
encodeTensorData x (Scalar y) = encodeTensorData x (V.fromList [y])
|
encodeTensorData x (Scalar y) = encodeTensorData x (V.fromList [y])
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ protoShape :: Lens' TensorShapeProto Shape
|
||||||
protoShape = iso protoToShape shapeToProto
|
protoShape = iso protoToShape shapeToProto
|
||||||
where
|
where
|
||||||
protoToShape = Shape . fmap (view size) . view dim
|
protoToShape = Shape . fmap (view size) . view dim
|
||||||
shapeToProto (Shape ds) = def & dim .~ fmap (\d -> def & size .~ d) ds
|
shapeToProto (Shape ds) = (def :: TensorShapeProto) & dim .~ fmap (\d -> def & size .~ d) ds
|
||||||
|
|
||||||
|
|
||||||
class Attribute a where
|
class Attribute a where
|
||||||
|
@ -410,7 +410,7 @@ instance All Eq (Map f as) => Eq (ListOf f as) where
|
||||||
(x :/ xs) == (y :/ ys) = x == y && xs == ys
|
(x :/ xs) == (y :/ ys) = x == y && xs == ys
|
||||||
-- Newer versions of GHC use the GADT to tell that the previous cases are
|
-- Newer versions of GHC use the GADT to tell that the previous cases are
|
||||||
-- exhaustive.
|
-- exhaustive.
|
||||||
#if _GLASGOW_HASKELL__ < 800
|
#if __GLASGOW_HASKELL__ < 800
|
||||||
_ == _ = False
|
_ == _ = False
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,9 @@ library
|
||||||
other-modules: TensorFlow.Internal.Raw
|
other-modules: TensorFlow.Internal.Raw
|
||||||
, TensorFlow.Orphans
|
, TensorFlow.Orphans
|
||||||
build-tools: c2hs
|
build-tools: c2hs
|
||||||
build-depends: proto-lens == 0.1.*
|
build-depends: proto-lens == 0.2.*
|
||||||
-- Used by the custom Setup script (for the test-suite).
|
-- Used by the custom Setup script (for the test-suite).
|
||||||
, proto-lens-protoc == 0.1.*
|
, proto-lens-protoc == 0.2.*
|
||||||
, tensorflow-proto == 0.1.*
|
, tensorflow-proto == 0.1.*
|
||||||
, base >= 4.7 && < 5
|
, base >= 4.7 && < 5
|
||||||
, async
|
, async
|
||||||
|
|
Loading…
Reference in a new issue