1
0
Fork 0
mirror of https://github.com/tensorflow/haskell.git synced 2024-11-23 03:19:44 +01:00

Update to current proto-lens packages. (#258)

This commit is contained in:
Mike Sperber 2020-05-21 22:36:52 +02:00 committed by GitHub
parent 0f322b2e06
commit 568c9b6f03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 26 additions and 40 deletions

View file

@ -1,4 +1,4 @@
resolver: lts-14.4 resolver: lts-15.11
packages: packages:
- tensorflow - tensorflow

View file

@ -16,10 +16,10 @@ library
exposed-modules: TensorFlow.GenOps.Core exposed-modules: TensorFlow.GenOps.Core
autogen-modules: TensorFlow.GenOps.Core autogen-modules: TensorFlow.GenOps.Core
build-depends: bytestring build-depends: bytestring
, proto-lens >= 0.4.0 && < 0.6.0 , proto-lens == 0.6.*
, tensorflow == 0.2.* , tensorflow == 0.2.*
, base >= 4.7 && < 5 , base >= 4.7 && < 5
, lens-family , lens-family == 2.*
, text , text
default-language: Haskell2010 default-language: Haskell2010
@ -27,7 +27,7 @@ custom-setup
setup-depends: Cabal setup-depends: Cabal
, bytestring , bytestring
, directory , directory
, proto-lens >= 0.4.0 && < 0.6.0 , proto-lens == 0.6.*
, tensorflow-opgen == 0.2.* , tensorflow-opgen == 0.2.*
, tensorflow == 0.2.* , tensorflow == 0.2.*
, base >= 4.7 && < 5 , base >= 4.7 && < 5

View file

@ -23,8 +23,8 @@ library
, exceptions , exceptions
, filepath , filepath
, hostname , hostname
, lens-family , lens-family == 2.*
, proto-lens >= 0.4.0 && < 0.6.0 , proto-lens == 0.6.*
, resourcet , resourcet
, stm , stm
, stm-chans , stm-chans

View file

@ -24,7 +24,6 @@ import Control.Monad (when, liftM)
import Data.Binary.Get (Get, runGet, getWord32be, getLazyByteString) import Data.Binary.Get (Get, runGet, getWord32be, getLazyByteString)
import Data.ByteString.Lazy (toStrict, readFile) import Data.ByteString.Lazy (toStrict, readFile)
import Data.List.Split (chunksOf) import Data.List.Split (chunksOf)
import Data.Monoid ((<>))
import Data.ProtoLens (Message, decodeMessageOrDie) import Data.ProtoLens (Message, decodeMessageOrDie)
import Data.Text (Text) import Data.Text (Text)
import Data.Word (Word8, Word32) import Data.Word (Word8, Word32)

View file

@ -20,12 +20,12 @@ 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.4.0 && < 0.6.0 build-depends: proto-lens == 0.6.*
, base >= 4.7 && < 5 , base >= 4.7 && < 5
, binary , binary
, bytestring , bytestring
, filepath , filepath
, lens-family , lens-family >= 2.0
, containers , containers
, split , split
, tensorflow-proto == 0.2.* , tensorflow-proto == 0.2.*

View file

@ -72,7 +72,6 @@ import Proto.Tensorflow.Core.Framework.OpDef_Fields
import Proto.Tensorflow.Core.Framework.Types (DataType(..)) import Proto.Tensorflow.Core.Framework.Types (DataType(..))
import System.FilePath (takeBaseName) import System.FilePath (takeBaseName)
import TensorFlow.OpGen.ParsedOp import TensorFlow.OpGen.ParsedOp
import Data.Semigroup ((<>))
import Text.PrettyPrint.Mainland import Text.PrettyPrint.Mainland
( Doc ( Doc
, (<+>) , (<+>)

View file

@ -25,7 +25,6 @@ import Data.Char (toUpper, toLower)
import Data.List (sortBy) import Data.List (sortBy)
import Data.List.NonEmpty (NonEmpty, nonEmpty) import Data.List.NonEmpty (NonEmpty, nonEmpty)
import Data.Maybe (mapMaybe) import Data.Maybe (mapMaybe)
import Data.Monoid ((<>))
import Data.Ord (comparing) import Data.Ord (comparing)
import qualified Data.Set as Set import qualified Data.Set as Set
import Data.Text (Text) import Data.Text (Text)

View file

@ -16,13 +16,13 @@ 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.4.0 && < 0.6.0 build-depends: proto-lens == 0.6.*
, tensorflow-proto == 0.2.* , tensorflow-proto == 0.2.*
, base >= 4.7 && < 5 , base >= 4.7 && < 5
, bytestring , bytestring
, containers , containers
, filepath , filepath
, lens-family , lens-family == 2.*
, mainland-pretty , mainland-pretty
, optparse-applicative , optparse-applicative
, semigroups , semigroups

View file

@ -43,10 +43,10 @@ import Data.ProtoLens.TextFormat (showMessage)
import Data.Set (Set) import Data.Set (Set)
import Data.Text (Text) import Data.Text (Text)
import Data.Tuple (swap) import Data.Tuple (swap)
import Lens.Family2 (Lens', view, (&), (^.), (.~), (%~)) import Lens.Family2 (Lens', view, (&), (^.), (.~), (%~), under)
import Lens.Family2.State.Strict (uses) import Lens.Family2.State.Strict (uses)
import Lens.Family2.Stock (at, intAt) import Lens.Family2.Stock (at, intAt)
import Lens.Family2.Unchecked (lens, iso) import Lens.Family2.Unchecked (lens, adapter)
import Prelude hiding (sum, tanh) import Prelude hiding (sum, tanh)
import Text.Printf (printf) import Text.Printf (printf)
import qualified Data.Graph.Inductive.Basic as FGL import qualified Data.Graph.Inductive.Basic as FGL
@ -244,7 +244,7 @@ _ `safeIndex` n | n < 0 = Nothing
-- Copy of http://hackage.haskell.org/package/lens-3.9.0.2/docs/Control-Lens-Iso.html#v%3anon -- Copy of http://hackage.haskell.org/package/lens-3.9.0.2/docs/Control-Lens-Iso.html#v%3anon
anon :: a -> (a -> Bool) -> Lens' (Maybe a) a anon :: a -> (a -> Bool) -> Lens' (Maybe a) a
anon a p = iso (fromMaybe a) go where anon a p = under (adapter (fromMaybe a) go) where
go b | p b = Nothing go b | p b = Nothing
| otherwise = Just b | otherwise = Just b

View file

@ -11,7 +11,6 @@
{-# LANGUAGE RecursiveDo #-} {-# LANGUAGE RecursiveDo #-}
{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NoMonadFailDesugaring #-}
module TensorFlow.Variable module TensorFlow.Variable
( Variable ( Variable
, variable , variable

View file

@ -21,13 +21,13 @@ library
, TensorFlow.NN , TensorFlow.NN
, TensorFlow.Queue , TensorFlow.Queue
, TensorFlow.Variable , TensorFlow.Variable
build-depends: proto-lens >= 0.4.0 && < 0.6.0 build-depends: proto-lens == 0.6.*
, base >= 4.7 && < 5 , base >= 4.7 && < 5
, bytestring , bytestring
, fgl , fgl
, mtl , mtl
, data-default , data-default
, lens-family , lens-family == 2.*
, containers , containers
, tensorflow == 0.2.* , tensorflow == 0.2.*
, tensorflow-proto == 0.2.* , tensorflow-proto == 0.2.*

View file

@ -15,7 +15,6 @@
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-} {-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE NoMonadFailDesugaring #-}
-- | Tests for EmbeddingOps. -- | Tests for EmbeddingOps.
module Main where module Main where

View file

@ -16,7 +16,6 @@
{-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoMonadFailDesugaring #-}
import Data.Int (Int32, Int64) import Data.Int (Int32, Int64)
import Data.List (sort) import Data.List (sort)
@ -33,7 +32,7 @@ import Control.Monad(forM_, replicateM, zipWithM)
import Control.Monad.IO.Class (liftIO) import Control.Monad.IO.Class (liftIO)
import qualified TensorFlow.Core as TF import qualified TensorFlow.Core as TF
import qualified TensorFlow.GenOps.Core as TF (conv2DBackpropInput', max, maximum, resizeBilinear', tile, pad, batchToSpaceND, spaceToBatchND, squeeze, sqrt, slice, shape, diag, depthwiseConv2dNative', depthwiseConv2dNativeBackpropInput', batchMatMul, batchMatMul', sum, conjugateTranspose) import qualified TensorFlow.GenOps.Core as TF (conv2DBackpropInput', max, maximum, resizeBilinear', tile, pad, batchToSpaceND, spaceToBatchND, squeeze, sqrt, slice, shape, diag, depthwiseConv2dNative', depthwiseConv2dNativeBackpropInput', batchMatMul, batchMatMul', conjugateTranspose)
import qualified TensorFlow.Gradient as TF import qualified TensorFlow.Gradient as TF
import qualified TensorFlow.Ops as TF hiding (zeroInitializedVariable, shape) import qualified TensorFlow.Ops as TF hiding (zeroInitializedVariable, shape)
import qualified TensorFlow.Output as TF import qualified TensorFlow.Output as TF

View file

@ -176,9 +176,9 @@ library
, Proto.Tensorflow.Core.Util.SavedTensorSlice_Fields , Proto.Tensorflow.Core.Util.SavedTensorSlice_Fields
, Proto.Tensorflow.Core.Util.TestLog , Proto.Tensorflow.Core.Util.TestLog
, Proto.Tensorflow.Core.Util.TestLog_Fields , Proto.Tensorflow.Core.Util.TestLog_Fields
build-depends: proto-lens >= 0.4.0 && < 0.6.0 build-depends: proto-lens == 0.6.*
, proto-lens-runtime >= 0.4.0 && < 0.6.0 , proto-lens-runtime == 0.6.*
, proto-lens-protobuf-types >= 0.4.0 && < 0.6.0 , proto-lens-protobuf-types == 0.6.*
, base >= 4.7 && < 5 , base >= 4.7 && < 5
default-language: Haskell2010 default-language: Haskell2010
include-dirs: . include-dirs: .

View file

@ -17,7 +17,6 @@ module Main where
import qualified Data.ByteString as B import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as BL import qualified Data.ByteString.Lazy as BL
import Data.Monoid ((<>))
import Data.Word (Word8) import Data.Word (Word8)
import Data.Serialize (runGet, runPut) import Data.Serialize (runGet, runPut)
import Test.Framework (Test, defaultMain) import Test.Framework (Test, defaultMain)

View file

@ -65,12 +65,10 @@ import Data.ProtoLens.Message(defMessage)
import Control.Monad.Catch (MonadThrow, MonadCatch, MonadMask) import Control.Monad.Catch (MonadThrow, MonadCatch, MonadMask)
import Control.Monad.Fix (MonadFix(..)) import Control.Monad.Fix (MonadFix(..))
import Control.Monad.IO.Class (MonadIO(..)) import Control.Monad.IO.Class (MonadIO(..))
import Control.Monad.Fail (MonadFail(..))
import Control.Monad.Trans.Class (MonadTrans(..)) import Control.Monad.Trans.Class (MonadTrans(..))
import Control.Monad.Trans.State.Strict(StateT(..), mapStateT, evalStateT) import Control.Monad.Trans.State.Strict(StateT(..), mapStateT, evalStateT)
import Data.Functor.Identity (Identity(..)) import Data.Functor.Identity (Identity(..))
import qualified Data.Map.Strict as Map import qualified Data.Map.Strict as Map
import Data.Monoid ((<>))
import qualified Data.Set as Set import qualified Data.Set as Set
import Data.Set (Set) import Data.Set (Set)
import Data.String (IsString(..)) import Data.String (IsString(..))

View file

@ -28,7 +28,6 @@ module TensorFlow.Internal.VarInt
import Data.Attoparsec.ByteString as Parse import Data.Attoparsec.ByteString as Parse
import Data.Bits import Data.Bits
import Data.ByteString.Lazy.Builder as Builder import Data.ByteString.Lazy.Builder as Builder
import Data.Monoid ((<>))
import Data.Word (Word64) import Data.Word (Word64)
-- | Decode an unsigned varint. -- | Decode an unsigned varint.

View file

@ -26,7 +26,6 @@ module TensorFlow.Nodes where
import Control.Applicative (liftA2, liftA3) import Control.Applicative (liftA2, liftA3)
import Data.Functor.Identity (Identity) import Data.Functor.Identity (Identity)
import Data.Map.Strict (Map) import Data.Map.Strict (Map)
import Data.Monoid ((<>))
import Data.Set (Set) import Data.Set (Set)
import Data.Text (Text) import Data.Text (Text)
import qualified Data.Map.Strict as Map import qualified Data.Map.Strict as Map

View file

@ -39,14 +39,12 @@ module TensorFlow.Session (
import Data.ProtoLens.Message(defMessage) import Data.ProtoLens.Message(defMessage)
import Control.Monad (forever, unless, void) import Control.Monad (forever, unless, void)
import Control.Monad.Fail (MonadFail(..))
import Control.Monad.Catch (MonadThrow, MonadCatch, MonadMask) import Control.Monad.Catch (MonadThrow, MonadCatch, MonadMask)
import Control.Monad.IO.Class (MonadIO, liftIO) import Control.Monad.IO.Class (MonadIO, liftIO)
import Control.Monad.Trans.Class (MonadTrans, lift) import Control.Monad.Trans.Class (MonadTrans, lift)
import Control.Monad.Trans.Reader (ReaderT(..), ask, asks) import Control.Monad.Trans.Reader (ReaderT(..), ask, asks)
import Data.ByteString (ByteString) import Data.ByteString (ByteString)
import Data.Default (Default, def) import Data.Default (Default, def)
import Data.Monoid ((<>))
import Data.ProtoLens (showMessage) import Data.ProtoLens (showMessage)
import Data.Set (Set) import Data.Set (Set)
import Data.Text.Encoding (encodeUtf8) import Data.Text.Encoding (encodeUtf8)

View file

@ -69,15 +69,14 @@ import Data.Functor.Identity (Identity(..))
import Data.Complex (Complex) import Data.Complex (Complex)
import Data.Int (Int8, Int16, Int32, Int64) import Data.Int (Int8, Int16, Int32, Int64)
import Data.Maybe (fromMaybe) import Data.Maybe (fromMaybe)
import Data.Monoid ((<>))
import Data.ProtoLens.TextFormat (showMessageShort) import Data.ProtoLens.TextFormat (showMessageShort)
import Data.Proxy (Proxy(..)) import Data.Proxy (Proxy(..))
import Data.String (IsString) import Data.String (IsString)
import Data.Word (Word8, Word16, Word32, Word64) import Data.Word (Word8, Word16, Word32, Word64)
import Foreign.Storable (Storable) import Foreign.Storable (Storable)
import GHC.Exts (Constraint, IsList(..)) import GHC.Exts (Constraint, IsList(..))
import Lens.Family2 (Lens', view, (&), (.~), (^..)) import Lens.Family2 (Lens', view, (&), (.~), (^..), under)
import Lens.Family2.Unchecked (iso) import Lens.Family2.Unchecked (adapter)
import Text.Printf (printf) import Text.Printf (printf)
import qualified Data.Attoparsec.ByteString as Atto import qualified Data.Attoparsec.ByteString as Atto
import Data.ByteString (ByteString) import Data.ByteString (ByteString)
@ -164,7 +163,7 @@ instance TensorType Int64 where
tensorVal = int64Val tensorVal = int64Val
integral :: Integral a => Lens' [Int32] [a] integral :: Integral a => Lens' [Int32] [a]
integral = iso (fmap fromIntegral) (fmap fromIntegral) integral = under (adapter (fmap fromIntegral) (fmap fromIntegral))
instance TensorType Word8 where instance TensorType Word8 where
tensorType _ = DT_UINT8 tensorType _ = DT_UINT8
@ -395,7 +394,7 @@ instance IsList Shape where
toList (Shape ss) = toList ss toList (Shape ss) = toList ss
protoShape :: Lens' TensorShapeProto Shape protoShape :: Lens' TensorShapeProto Shape
protoShape = iso protoToShape shapeToProto protoShape = under (adapter protoToShape shapeToProto)
where where
protoToShape p = fromMaybe (error msg) (view protoMaybeShape p) protoToShape p = fromMaybe (error msg) (view protoMaybeShape p)
where msg = "Can't convert TensorShapeProto with unknown rank to Shape: " where msg = "Can't convert TensorShapeProto with unknown rank to Shape: "
@ -403,7 +402,7 @@ protoShape = iso protoToShape shapeToProto
shapeToProto s' = defMessage & protoMaybeShape .~ Just s' shapeToProto s' = defMessage & protoMaybeShape .~ Just s'
protoMaybeShape :: Lens' TensorShapeProto (Maybe Shape) protoMaybeShape :: Lens' TensorShapeProto (Maybe Shape)
protoMaybeShape = iso protoToShape shapeToProto protoMaybeShape = under (adapter protoToShape shapeToProto)
where where
protoToShape :: TensorShapeProto -> Maybe Shape protoToShape :: TensorShapeProto -> Maybe Shape
protoToShape p = protoToShape p =

View file

@ -36,7 +36,7 @@ library
, TensorFlow.Types , TensorFlow.Types
other-modules: TensorFlow.Internal.Raw other-modules: TensorFlow.Internal.Raw
build-tools: c2hs build-tools: c2hs
build-depends: proto-lens >= 0.4.0 && < 0.6.0 build-depends: proto-lens == 0.6.*
, tensorflow-proto == 0.2.* , tensorflow-proto == 0.2.*
, base >= 4.7 && < 5 , base >= 4.7 && < 5
, async , async
@ -46,7 +46,7 @@ library
, data-default , data-default
, exceptions , exceptions
, fgl , fgl
, lens-family , lens-family == 2.*
, mainland-pretty , mainland-pretty
, mtl , mtl
, semigroups , semigroups