Skip to content

Commit

Permalink
Update to tensorflow 1.3 (tensorflow#161)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
fkm3 authored Oct 19, 2017
1 parent 2dcc921 commit 7720af0
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 13 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -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`.
Expand Down
4 changes: 2 additions & 2 deletions ci_build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 8 additions & 1 deletion tensorflow-core-ops/Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tensorflow-mnist/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE TypeApplications #-}

import Control.Monad (forM_, when)
import Control.Monad.IO.Class (liftIO)
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion tensorflow-proto/tensorflow-proto.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion tensorflow/src/TensorFlow/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion third_party/tensorflow
Submodule tensorflow updated 6682 files
2 changes: 1 addition & 1 deletion tools/install_macos_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions tools/userchroot.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand Down Expand Up @@ -63,4 +63,3 @@ stdenv.mkDerivation {
nativeBuildInputs = [ fhs ];
shellHook = "exec fhs";
}

0 comments on commit 7720af0

Please sign in to comment.