1
0
Fork 0
mirror of https://github.com/tensorflow/haskell.git synced 2024-12-24 18:49:46 +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:
fkm3 2017-10-19 13:41:55 -04:00 committed by GitHub
parent 2dcc921f6e
commit 7720af0afd
10 changed files with 25 additions and 13 deletions

View file

@ -1,6 +1,7 @@
# ChangeLog
## Upcoming (v0.2.0.0)
- Switch to tensorflow 1.3.
- Expand the `Rendered` class and add a `ToTensor` class to let more functions
(gradients, feed, colocateWith) support `ResourceHandle` wrappers like
`Variables`.

View file

@ -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 && \
unzip -d /usr/local protoc-3.2.0-linux-x86_64.zip 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 && \
tar zxf libtensorflow-cpu-linux-x86_64-1.0.0.tar.gz -C /usr/local && \
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.3.0.tar.gz -C /usr/local && \
ldconfig && \
stack setup && \
stack test --only-dependencies

View file

@ -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 && \
unzip -d /usr/local protoc-3.2.0-linux-x86_64.zip 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 && \
tar zxf libtensorflow-cpu-linux-x86_64-1.0.0.tar.gz -C /usr/local && \
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.3.0.tar.gz -C /usr/local && \
ldconfig
ENV LANG en_US.UTF-8

View file

@ -90,7 +90,14 @@ fudgePackageDesc lbi p = p
blackList =
[ -- Requires the "func" type:
"SymbolicGradient"
"FilterDataset"
, "FlatMapDataset"
, "GroupByWindowDataset"
, "InterleaveDataset"
, "MapDataset"
, "OneShotIterator"
, "ParallelMapDataset"
, "SymbolicGradient"
]
autogenModulesDir :: LocalBuildInfo -> FilePath

View file

@ -14,6 +14,7 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE TypeApplications #-}
import Control.Monad (forM_, when)
import Control.Monad.IO.Class (liftIO)
@ -75,7 +76,7 @@ createModel = do
logitBiases <- TF.zeroInitializedVariable [numLabels]
let logits = (hidden `TF.matMul` TF.readValue logitWeights)
`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))
-- Create training action.

View file

@ -42,15 +42,17 @@ library
, Proto.Tensorflow.Core.Framework.Variable
, Proto.Tensorflow.Core.Framework.Versions
, Proto.Tensorflow.Core.Lib.Core.ErrorCodes
, Proto.Tensorflow.Core.Protobuf.Cluster
, Proto.Tensorflow.Core.Protobuf.Config
, Proto.Tensorflow.Core.Protobuf.ControlFlow
, Proto.Tensorflow.Core.Protobuf.Debug
, Proto.Tensorflow.Core.Protobuf.MetaGraph
, Proto.Tensorflow.Core.Protobuf.NamedTensor
, Proto.Tensorflow.Core.Protobuf.QueueRunner
, Proto.Tensorflow.Core.Protobuf.TensorBundle
, Proto.Tensorflow.Core.Protobuf.RewriterConfig
, Proto.Tensorflow.Core.Protobuf.SavedModel
, Proto.Tensorflow.Core.Protobuf.Saver
, Proto.Tensorflow.Core.Protobuf.TensorBundle
, Proto.Tensorflow.Core.Protobuf.TensorflowServer
, Proto.Tensorflow.Core.Util.Event
, Proto.Tensorflow.Core.Util.MemmappedFileSystem

View file

@ -97,7 +97,7 @@ import Proto.Tensorflow.Core.Framework.AttrValue
, tensor
)
import Proto.Tensorflow.Core.Framework.ResourceHandle
(ResourceHandle)
(ResourceHandleProto)
import Proto.Tensorflow.Core.Framework.Tensor as Tensor
( TensorProto(..)
, boolVal
@ -119,6 +119,8 @@ import Proto.Tensorflow.Core.Framework.Types (DataType(..))
import TensorFlow.Internal.VarInt (getVarInt, putVarInt)
import qualified TensorFlow.Internal.FFI as FFI
type ResourceHandle = ResourceHandleProto
-- | The class of scalar types supported by tensorflow.
class TensorType a where
tensorType :: a -> DataType

@ -1 +1 @@
Subproject commit 0c68156ffcf918df905f9f39a632888724c66c3b
Subproject commit 408fd454d7d2a16269576ea12bcd516e25a6b0c5

View file

@ -25,7 +25,7 @@ else
fi
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..."
sudo tar zxf libtensorflow.tar.gz -C /usr/local

View file

@ -13,8 +13,8 @@ let
name = "tensorflow-c";
src = fetchurl {
url = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.0.0.tar.gz";
sha256 = "1kmss9wdri5ibd19b4ymh2dvajw5cy34bxzxlaa5i60hiwpppljy";
url = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.3.0.tar.gz";
sha256 = "1d4bda5316063b70cf50a668d774b2067ef2a8ab163ff2eb29592bf3c24e2183";
};
buildCommand = ''
@ -63,4 +63,3 @@ stdenv.mkDerivation {
nativeBuildInputs = [ fhs ];
shellHook = "exec fhs";
}