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:
- tensorflow

View File

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

View File

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

View File

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

View File

@ -20,12 +20,12 @@ library
exposed-modules: TensorFlow.Examples.MNIST.Parse
, TensorFlow.Examples.MNIST.TrainedGraph
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
, binary
, bytestring
, filepath
, lens-family
, lens-family >= 2.0
, containers
, split
, 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 System.FilePath (takeBaseName)
import TensorFlow.OpGen.ParsedOp
import Data.Semigroup ((<>))
import Text.PrettyPrint.Mainland
( Doc
, (<+>)

View File

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

View File

@ -16,13 +16,13 @@ library
hs-source-dirs: src
exposed-modules: TensorFlow.OpGen.ParsedOp
, TensorFlow.OpGen
build-depends: proto-lens >= 0.4.0 && < 0.6.0
build-depends: proto-lens == 0.6.*
, tensorflow-proto == 0.2.*
, base >= 4.7 && < 5
, bytestring
, containers
, filepath
, lens-family
, lens-family == 2.*
, mainland-pretty
, optparse-applicative
, semigroups

View File

@ -43,10 +43,10 @@ import Data.ProtoLens.TextFormat (showMessage)
import Data.Set (Set)
import Data.Text (Text)
import Data.Tuple (swap)
import Lens.Family2 (Lens', view, (&), (^.), (.~), (%~))
import Lens.Family2 (Lens', view, (&), (^.), (.~), (%~), under)
import Lens.Family2.State.Strict (uses)
import Lens.Family2.Stock (at, intAt)
import Lens.Family2.Unchecked (lens, iso)
import Lens.Family2.Unchecked (lens, adapter)
import Prelude hiding (sum, tanh)
import Text.Printf (printf)
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
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
| otherwise = Just b

View File

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

View File

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

View File

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

View File

@ -16,7 +16,6 @@
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoMonadFailDesugaring #-}
import Data.Int (Int32, Int64)
import Data.List (sort)
@ -33,7 +32,7 @@ import Control.Monad(forM_, replicateM, zipWithM)
import Control.Monad.IO.Class (liftIO)
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.Ops as TF hiding (zeroInitializedVariable, shape)
import qualified TensorFlow.Output as TF

View File

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

View File

@ -17,7 +17,6 @@ module Main where
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as BL
import Data.Monoid ((<>))
import Data.Word (Word8)
import Data.Serialize (runGet, runPut)
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.Fix (MonadFix(..))
import Control.Monad.IO.Class (MonadIO(..))
import Control.Monad.Fail (MonadFail(..))
import Control.Monad.Trans.Class (MonadTrans(..))
import Control.Monad.Trans.State.Strict(StateT(..), mapStateT, evalStateT)
import Data.Functor.Identity (Identity(..))
import qualified Data.Map.Strict as Map
import Data.Monoid ((<>))
import qualified Data.Set as Set
import Data.Set (Set)
import Data.String (IsString(..))

View File

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

View File

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

View File

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

View File

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

View File

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