mirror of
https://github.com/tensorflow/haskell.git
synced 2024-11-26 21:09:44 +01:00
Update to tensorflow 1.3 (#161)
* Tested on linux without Docker. * Couldn't get nix build to work, so I just updated the URL and hash. * Did not test macos build. The mnist change was necessary because the argmax output type is now polmorphic.
This commit is contained in:
parent
2dcc921f6e
commit
7720af0afd
10 changed files with 25 additions and 13 deletions
|
@ -1,6 +1,7 @@
|
||||||
# ChangeLog
|
# ChangeLog
|
||||||
|
|
||||||
## Upcoming (v0.2.0.0)
|
## Upcoming (v0.2.0.0)
|
||||||
|
- Switch to tensorflow 1.3.
|
||||||
- Expand the `Rendered` class and add a `ToTensor` class to let more functions
|
- Expand the `Rendered` class and add a `ToTensor` class to let more functions
|
||||||
(gradients, feed, colocateWith) support `ResourceHandle` wrappers like
|
(gradients, feed, colocateWith) support `ResourceHandle` wrappers like
|
||||||
`Variables`.
|
`Variables`.
|
||||||
|
|
|
@ -28,8 +28,8 @@ RUN \
|
||||||
curl -O -L https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip && \
|
curl -O -L https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip && \
|
||||||
unzip -d /usr/local protoc-3.2.0-linux-x86_64.zip bin/protoc && \
|
unzip -d /usr/local protoc-3.2.0-linux-x86_64.zip bin/protoc && \
|
||||||
chmod 755 /usr/local/bin/protoc && \
|
chmod 755 /usr/local/bin/protoc && \
|
||||||
curl -O https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.0.0.tar.gz && \
|
curl -O https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.3.0.tar.gz && \
|
||||||
tar zxf libtensorflow-cpu-linux-x86_64-1.0.0.tar.gz -C /usr/local && \
|
tar zxf libtensorflow-cpu-linux-x86_64-1.3.0.tar.gz -C /usr/local && \
|
||||||
ldconfig && \
|
ldconfig && \
|
||||||
stack setup && \
|
stack setup && \
|
||||||
stack test --only-dependencies
|
stack test --only-dependencies
|
||||||
|
|
|
@ -25,8 +25,8 @@ RUN \
|
||||||
curl -O -L https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip && \
|
curl -O -L https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip && \
|
||||||
unzip -d /usr/local protoc-3.2.0-linux-x86_64.zip bin/protoc && \
|
unzip -d /usr/local protoc-3.2.0-linux-x86_64.zip bin/protoc && \
|
||||||
chmod 755 /usr/local/bin/protoc && \
|
chmod 755 /usr/local/bin/protoc && \
|
||||||
curl -O https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.0.0.tar.gz && \
|
curl -O https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.3.0.tar.gz && \
|
||||||
tar zxf libtensorflow-cpu-linux-x86_64-1.0.0.tar.gz -C /usr/local && \
|
tar zxf libtensorflow-cpu-linux-x86_64-1.3.0.tar.gz -C /usr/local && \
|
||||||
ldconfig
|
ldconfig
|
||||||
|
|
||||||
ENV LANG en_US.UTF-8
|
ENV LANG en_US.UTF-8
|
||||||
|
|
|
@ -90,7 +90,14 @@ fudgePackageDesc lbi p = p
|
||||||
|
|
||||||
blackList =
|
blackList =
|
||||||
[ -- Requires the "func" type:
|
[ -- Requires the "func" type:
|
||||||
"SymbolicGradient"
|
"FilterDataset"
|
||||||
|
, "FlatMapDataset"
|
||||||
|
, "GroupByWindowDataset"
|
||||||
|
, "InterleaveDataset"
|
||||||
|
, "MapDataset"
|
||||||
|
, "OneShotIterator"
|
||||||
|
, "ParallelMapDataset"
|
||||||
|
, "SymbolicGradient"
|
||||||
]
|
]
|
||||||
|
|
||||||
autogenModulesDir :: LocalBuildInfo -> FilePath
|
autogenModulesDir :: LocalBuildInfo -> FilePath
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
{-# LANGUAGE OverloadedLists #-}
|
{-# LANGUAGE OverloadedLists #-}
|
||||||
|
{-# LANGUAGE TypeApplications #-}
|
||||||
|
|
||||||
import Control.Monad (forM_, when)
|
import Control.Monad (forM_, when)
|
||||||
import Control.Monad.IO.Class (liftIO)
|
import Control.Monad.IO.Class (liftIO)
|
||||||
|
@ -75,7 +76,7 @@ createModel = do
|
||||||
logitBiases <- TF.zeroInitializedVariable [numLabels]
|
logitBiases <- TF.zeroInitializedVariable [numLabels]
|
||||||
let logits = (hidden `TF.matMul` TF.readValue logitWeights)
|
let logits = (hidden `TF.matMul` TF.readValue logitWeights)
|
||||||
`TF.add` TF.readValue logitBiases
|
`TF.add` TF.readValue logitBiases
|
||||||
predict <- TF.render $ TF.cast $
|
predict <- TF.render @TF.Build @LabelType $
|
||||||
TF.argMax (TF.softmax logits) (TF.scalar (1 :: LabelType))
|
TF.argMax (TF.softmax logits) (TF.scalar (1 :: LabelType))
|
||||||
|
|
||||||
-- Create training action.
|
-- Create training action.
|
||||||
|
|
|
@ -42,15 +42,17 @@ library
|
||||||
, Proto.Tensorflow.Core.Framework.Variable
|
, Proto.Tensorflow.Core.Framework.Variable
|
||||||
, Proto.Tensorflow.Core.Framework.Versions
|
, Proto.Tensorflow.Core.Framework.Versions
|
||||||
, Proto.Tensorflow.Core.Lib.Core.ErrorCodes
|
, Proto.Tensorflow.Core.Lib.Core.ErrorCodes
|
||||||
|
, Proto.Tensorflow.Core.Protobuf.Cluster
|
||||||
, Proto.Tensorflow.Core.Protobuf.Config
|
, Proto.Tensorflow.Core.Protobuf.Config
|
||||||
, Proto.Tensorflow.Core.Protobuf.ControlFlow
|
, Proto.Tensorflow.Core.Protobuf.ControlFlow
|
||||||
, Proto.Tensorflow.Core.Protobuf.Debug
|
, Proto.Tensorflow.Core.Protobuf.Debug
|
||||||
, Proto.Tensorflow.Core.Protobuf.MetaGraph
|
, Proto.Tensorflow.Core.Protobuf.MetaGraph
|
||||||
, Proto.Tensorflow.Core.Protobuf.NamedTensor
|
, Proto.Tensorflow.Core.Protobuf.NamedTensor
|
||||||
, Proto.Tensorflow.Core.Protobuf.QueueRunner
|
, Proto.Tensorflow.Core.Protobuf.QueueRunner
|
||||||
, Proto.Tensorflow.Core.Protobuf.TensorBundle
|
, Proto.Tensorflow.Core.Protobuf.RewriterConfig
|
||||||
, Proto.Tensorflow.Core.Protobuf.SavedModel
|
, Proto.Tensorflow.Core.Protobuf.SavedModel
|
||||||
, Proto.Tensorflow.Core.Protobuf.Saver
|
, Proto.Tensorflow.Core.Protobuf.Saver
|
||||||
|
, Proto.Tensorflow.Core.Protobuf.TensorBundle
|
||||||
, Proto.Tensorflow.Core.Protobuf.TensorflowServer
|
, Proto.Tensorflow.Core.Protobuf.TensorflowServer
|
||||||
, Proto.Tensorflow.Core.Util.Event
|
, Proto.Tensorflow.Core.Util.Event
|
||||||
, Proto.Tensorflow.Core.Util.MemmappedFileSystem
|
, Proto.Tensorflow.Core.Util.MemmappedFileSystem
|
||||||
|
|
|
@ -97,7 +97,7 @@ import Proto.Tensorflow.Core.Framework.AttrValue
|
||||||
, tensor
|
, tensor
|
||||||
)
|
)
|
||||||
import Proto.Tensorflow.Core.Framework.ResourceHandle
|
import Proto.Tensorflow.Core.Framework.ResourceHandle
|
||||||
(ResourceHandle)
|
(ResourceHandleProto)
|
||||||
import Proto.Tensorflow.Core.Framework.Tensor as Tensor
|
import Proto.Tensorflow.Core.Framework.Tensor as Tensor
|
||||||
( TensorProto(..)
|
( TensorProto(..)
|
||||||
, boolVal
|
, boolVal
|
||||||
|
@ -119,6 +119,8 @@ import Proto.Tensorflow.Core.Framework.Types (DataType(..))
|
||||||
import TensorFlow.Internal.VarInt (getVarInt, putVarInt)
|
import TensorFlow.Internal.VarInt (getVarInt, putVarInt)
|
||||||
import qualified TensorFlow.Internal.FFI as FFI
|
import qualified TensorFlow.Internal.FFI as FFI
|
||||||
|
|
||||||
|
type ResourceHandle = ResourceHandleProto
|
||||||
|
|
||||||
-- | The class of scalar types supported by tensorflow.
|
-- | The class of scalar types supported by tensorflow.
|
||||||
class TensorType a where
|
class TensorType a where
|
||||||
tensorType :: a -> DataType
|
tensorType :: a -> DataType
|
||||||
|
|
2
third_party/tensorflow
vendored
2
third_party/tensorflow
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 0c68156ffcf918df905f9f39a632888724c66c3b
|
Subproject commit 408fd454d7d2a16269576ea12bcd516e25a6b0c5
|
|
@ -25,7 +25,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Downloading libtensorflow..."
|
echo "Downloading libtensorflow..."
|
||||||
curl https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-1.0.0.tar.gz > libtensorflow.tar.gz
|
curl https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-1.3.0.tar.gz > libtensorflow.tar.gz
|
||||||
|
|
||||||
echo "Extracting and copying libtensorflow..."
|
echo "Extracting and copying libtensorflow..."
|
||||||
sudo tar zxf libtensorflow.tar.gz -C /usr/local
|
sudo tar zxf libtensorflow.tar.gz -C /usr/local
|
||||||
|
|
|
@ -13,8 +13,8 @@ let
|
||||||
name = "tensorflow-c";
|
name = "tensorflow-c";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.0.0.tar.gz";
|
url = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.3.0.tar.gz";
|
||||||
sha256 = "1kmss9wdri5ibd19b4ymh2dvajw5cy34bxzxlaa5i60hiwpppljy";
|
sha256 = "1d4bda5316063b70cf50a668d774b2067ef2a8ab163ff2eb29592bf3c24e2183";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
|
@ -63,4 +63,3 @@ stdenv.mkDerivation {
|
||||||
nativeBuildInputs = [ fhs ];
|
nativeBuildInputs = [ fhs ];
|
||||||
shellHook = "exec fhs";
|
shellHook = "exec fhs";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue