1
0
Fork 0
mirror of https://github.com/tensorflow/haskell.git synced 2024-11-01 00:29:42 +01:00
Commit graph

159 commits

Author SHA1 Message Date
Judah Jacobson
7328cb277f Fix the build with ghc-8.2.1. (#147)
- Avoid using a deprecated Cabal function
- Use newer versions of proto-lens packages in stack.yaml
- Work around a new type-level warning that affects `OneOf/TensorTypes`.
2017-08-08 09:48:59 -07:00
Judah Jacobson
56038ba27e Depend on a newer proto-lens and remove orphan Ord instances. (#146)
proto-lens-0.2.2.0 generates Ord instances for all message types,
so we can remove the orphan instances we previously added.

Dependends on proto-lens-protoc-0.2.2.1 or newer due to google/proto-lens#113.
2017-08-02 22:47:55 -07:00
Jonathan Kochems
79d8d7edea Adding gradient for Concat (#144) 2017-07-29 23:29:33 -04:00
fkm3
cac45d1cd6 Delete inaccurate comments 2017-07-25 09:38:00 -04:00
Christian Berentsen
bebc4aa7d9 Add gradient of 'maximum' and 'gradForBinaryCwise'
`maximum` gradient uses `gradForBinaryCwise` which may be useful for other
binary componentwise op gradients
2017-07-25 00:14:23 -04:00
Christian Berentsen
ea30577264 Gradient for AddN 2017-07-25 00:06:10 -04:00
Alan Yee
41f4c8a235 Change from OS X to macOS (#142)
* Update README.md

Update terminology to macOS.

Also rename install_osx_dependencies.sh to install_macos_dependencies.sh.
2017-07-20 13:17:50 -07:00
Divided By Zero
7817255c2b update readme for checking stack version (#143) 2017-07-17 09:04:15 -07:00
Christian Berentsen
4ab9cb9cf2 Moved reduceMean to Ops (#136) 2017-06-20 20:50:46 -07:00
Christian Berentsen
042910b000 Added logGraph for graph visualization in TensorBoard (#104) 2017-06-19 20:53:55 -07:00
Sergey Mironov
423b34537e Add minimal support for NixOS buildsystem (#134) 2017-06-10 22:24:54 -07:00
Judah Jacobson
80a5a4a7d0 Fill out the modules in tensorflow-proto. (#132)
That package now includes everything in the `tensorflow/core:protos_all` target:
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/BUILD#L131

I also made all of the modules exposed for simplicity.  (As a particular
example: `MetaGraph`, which was previously in `other-modules`, is useful for
constructing some TensorFlow serving RPCs.)

* Use the new release of proto-lens-{protoc,protobuf-types}.
2017-06-08 20:24:42 -07:00
Judah Jacobson
afbcd1b772 Note that we require stack-1.4.0 or newer.
This requirement is due to #106 which added Cabal `custom-setup` clauses.
2017-06-02 22:29:40 -07:00
helq
fc25db7a78 Modifying tensorflow-mnist-input-data's setup to download MNIST through http proxy if necessary (#127)
Changing way to download MNIST dataset from Network.HTTP.simpleHTTP to Network.Browser.browse which allows to capture the environment's proxy.
2017-05-28 22:56:15 -07:00
fkm3
0603a6987b Add Minimize module with gradient descent and adam implementations (#125) 2017-05-25 19:19:22 -07:00
fkm3
a86d424cac Add initializedValue function for Variable (#124) 2017-05-20 21:42:45 -07:00
Judah Jacobson
8e136d3a9c Start a changelog. (#123) 2017-05-17 23:43:08 -07:00
fkm3
b86945f008 Support Variable in TensorFlow.Gradient and use in mnist example (#116) 2017-05-17 13:20:51 -07:00
fkm3
ddb4fe4f90 Add ToTensor class 2017-05-16 23:05:33 -07:00
Judah Jacobson
d98e5d637c Add extra-lib-dirs back into .cabal for Mac builds. (#122)
Also bump the version to 0.1.0.2.

Originally we had `extra-lib-dirs: /usr/local/lib` in `stack.yaml`.
I removed it because it wasn't necessary on my Mac.  However,
it turns out that it is necessary for machines with the default installation
of XCode, which *doesn't* search that path by default.

(On my machine, it wasn't necessary because I had run `xcode-select --install`
which adds that path permanently to your search path.  For more context, see
https://github.com/Homebrew/brew/issues/556.)

I'm adding the setting back to `tensorflow.cabal` as well as `stack.yaml` so
that the Hackage release also contains this fix.  Changing `stack.yaml` is
still necessary in order to fix linkage in the `snappy` package (which
`tensorflow-records` depends on).  Hopefully that will go away once we remove
the dependency (#118).
2017-05-16 15:18:01 -07:00
fkm3
0f04e5a50d Expand Rendered class to support ResourceHandle wrappers like Variable
This allows functions like `feed`, `colocateWith`, and (in a later commit)
`gradients` to work with `Variable`.
2017-05-15 19:55:34 -07:00
Judah Jacobson
e924901b90 Remove extra-{include,lib}-dirs from stack.yaml. (#120)
As far as I can tell they're not necessary anymore with the current OS X
script that calls `install_name_tool`.  Both "stack test" and "stack ghci"
work without those settings.
2017-05-15 13:34:28 -07:00
Judah Jacobson
a7a2be2110 Include c_api.h in the tensorflow sdist. (#114)
Also bumps up the version of the 'tensorflow' package to 0.1.0.1.
2017-05-10 16:50:35 -07:00
Judah Jacobson
aa9efa3aa1 Fix 'sdist' for tensorflow-core-ops. (#113)
Use the same trick as for `proto-lens-protoc`: hack the package description
during the `sdist` step to include the autogen directory in hs-source-dirs.
2017-05-10 16:29:31 -07:00
Judah Jacobson
64971c876a Consolidate some packages. (#111)
- Merge tensorflow-nn and tensorflow-queue into tensorflow-ops.
  They don't add extra dependencies and each contain a single module, so I
  don't think it's worth separating them at the package level.
- Remove google-shim in favor of direct use of test-framework.
2017-05-10 15:26:03 -07:00
Judah Jacobson
0fa719b701 Fix .cabal files so 'stack check' passes. (#110)
- Add LICENSE files for all packages.
- Add descriptions for packages that were missing one.
- Work around google/proto-lens#69 by symlinking third_party into
  tensorflow-proto.
2017-05-10 11:37:00 -07:00
Greg Steuck
1d45e33d2a Switched to lts-8.13, added custom-setup. (#106)
* Switched to lts-8.13, added custom-setup.

Our packages no longer elicit complaints like this:
Package tensorflow-foo uses a custom Cabal build, but does not use a
custom-setup stanza.

* Removed some extra-deps and explicit-setup-deps

* Removed provisions for different versions of stack lts.

We are now solidly in the 8-only territory.
2017-05-09 20:49:51 -07:00
Judah Jacobson
ff5f1cccf4 Increase the number of iterations for MatrixTest. (#107)
The number of iterations was reduced from 1000 to 300 during review, but that
turned out to be too low and the test now fails about 20% of the time.
After changing it back to 1000, the test succeeded at 50 out of 50 runs.
2017-05-09 09:54:09 -07:00
Judah Jacobson
a64af5076a Work around #92 by always copying TensorData when fetching.
It would be better to avoid the copy when it's not necessary, but
that will require more involved changes to the internal API.  (For example,
Fetchable might need to allow IO or ST actions.)
2017-05-09 00:10:29 -07:00
Jarl Christian Berentsen
37e3c9b084 Whitespace 2017-05-05 16:49:27 -07:00
Jarl Christian Berentsen
d153d0aded Fixed matMul gradients for transposed arguments 2017-05-05 16:49:27 -07:00
Jarl Christian Berentsen
51014a015c Implemented TileGrad
Some notes about static shape inference
2017-05-05 16:49:27 -07:00
Jarl Christian Berentsen
97b4bb5bab Added reduceSum to Ops 2017-05-05 16:49:27 -07:00
Christian Berentsen
eca4ff8981 Implemented ReluGradGrad and FillGrad (#102)
Added testReluGrad, testReluGradGrad and testFillGrad
2017-04-30 11:18:06 -07:00
Chris Mckinlay
09c792b84c added matrix factorization test (#101) 2017-04-27 17:05:34 -07:00
Judah Jacobson
51c883684b Clarify the behavior of readValue in a comment. (#99)
Also add a unit test corresponding to that comments' example code.
2017-04-16 15:31:26 -07:00
Judah Jacobson
42f4fc647e Add resource-based variable ops. (#98)
The main difference between these and the `Ref`-bases ops is the explicit
`readValue` op.  I'm not sure how this should interact with gradients
and save/restore, so I'm keeping it as a separate module for now.  Once we
figure out the details, we can merge it into `TensorFlow.Ops` and replace
all uses of the old `Ref`-based ops.  (That would also fix #92.)

Also replaces our special case newtype `ResourceHandle` to
`Tensor Value ResourceHandle`, where `ResourceHandle` is the TF proto
corresponding to `DT_RESOURCE`.
2017-04-16 09:24:02 -07:00
Christian Berentsen
21b723d542 Adapt to lts-8.6 and use proto-lens-0.2.0.1 (#97) 2017-04-11 14:09:01 -07:00
Judah Jacobson
de16a576da Sort the ops generated in TensorFlow.GenOps.Core. (#96) 2017-04-08 07:15:28 -07:00
Judah Jacobson
55ca545915 Regenerate the Haddock docs. (#95) 2017-04-08 07:14:47 -07:00
Judah Jacobson
16d660c3bc Support a couple more ops by allowing larger tuples. (#93) 2017-04-06 19:00:18 -07:00
Judah Jacobson
d62c614695 Distinguish between "rendered" and "unrendered" Tensors. (#88)
Distinguish between "rendered" and "unrendered" Tensors.

There are now three types of `Tensor`:

- `Tensor Value a`: rendered value
- `Tensor Ref a`: rendered reference
- `Tensor Build a` : unrendered value

The extra bookkeeping makes it easier to track (and enforce) which tensors are
rendered or not.  For examples where this has been confusing in the past, see

With this change, pure ops look similar to before, returning `Tensor Build`
instead of `Tensor Value`.  "Stateful" (monadic) ops are unchanged.  For
example:

    add :: OneOf [..] t => Tensor v'1 t -> Tensor v'2 t -> Tensor Build t
    assign :: (MonadBuild m, TensorType t)
           => Tensor Ref t -> Tensor v'2 t -> m (Tensor Ref t)

The `gradients` function now requires that the variables over which it's
differentiating are pre-rendered:

    gradients :: (..., Rendered v2) => Tensor v1 a -> [Tensor v2 a]
              -> m [Tensor Value a]

(`Rendered v2` means that `v2` is either a `Ref` or a `Value`.)

Additionally, the implementation of `gradients` now takes care to render every
intermediate value when performing the reverse accumulation.  I suspect this
fixes an exponential blowup for complicated expressions.
2017-04-06 15:10:33 -07:00
Chris Mckinlay
d71f48090a call sudo consistently within OSX build script (#91)
previously I was getting the following error:

./: Can't update time for .
tar: Error exit delayed from previous errors.
2017-04-03 20:27:22 -07:00
Judah Jacobson
1f6115da5a Minor fix to codegen of INLINE pragma. (#85) 2017-04-03 20:25:55 -07:00
Judah Jacobson
a11a417ad5 Add another test of CSE and feeds. (#87)
As a follow-up to #86, check that our CSE isn't too aggressive to prevent feeds
of pure ops with distinct names.
2017-03-23 12:58:40 -07:00
Judah Jacobson
fdbfd050f8 Prevent CSE of placeholder ops. (#86)
The bug was introduced in #84.
2017-03-22 22:47:42 -07:00
Judah Jacobson
c99a23b6a7 Add versions of each op that take optional params as an extra arg. (#84)
Each op `foo :: ...` now has a corresponding `foo' :: OpParams -> ...`
which lets you set optional attributes.  `OpParams` is currently a type alias for
`OpDef -> OpDef`.  In the future we should consider more type safety, e.g.,
using type-level strings and OverloadedLabels for optional attributes.

I used it to replace a few manual `buildOp`s in our code with the codegenerated
ops, now that it's easier to set attributes.  I also removed `tensorAttr` and
`named` since it's now possible to set those op attributes directly.

Although this clutters up the API a bit, I think it's simpler than using type
classes to implement optional arguments (as in, for example, `Text.Printf`) --
especially in terms of type inference with the rest of the library.
2017-03-20 18:16:38 -07:00
Judah Jacobson
2c5c879037 Introduce a MonadBuild class, and remove buildAnd. (#83)
This change adds a class that both `Build` and `Session` are instances of:

    class MonadBuild m where
        build :: Build a -> m a

All stateful ops (generated and manually written) now have a signature that returns
an instance of `MonadBuild` (rather than just `Build`).  For example:

    assign_ :: (MonadBuild m, TensorType t)
            => Tensor Ref t -> Tensor v t -> m (Tensor Ref t)

This lets us remove a bunch of spurious calls to `build` in user code.  It also
lets us replace the pattern `buildAnd run foo` with the simpler pattern `foo >>= run`
(or `run =<< foo`, which is sometimes nicer when foo is a complicated expression).

I went ahead and deleted `buildAnd` altogether since it seems to lead to
confusion; in particular a few tests had `buildAnd run . pure` which is
actually equivalent to just `run`.
2017-03-18 12:08:53 -07:00
Judah Jacobson
9209dfc4c4 Support lists of tensors in ops. (#79)
Adds a new type `ListOf` which wraps a heterogeneous list; for example,
`ListOf (Tensor Value) '[Int32, Float]` represents a list of two
elements: a tensor of int32s and a tensor of floats.

Also changes the `Queue2` type (which suppored pairs of tensors) to
`Queue` (which supports arbitrary lists).
2017-03-17 13:53:19 -07:00
avctrh
7cc6a69866 Added installation script for OS X dependencies under tools/ (#80)
* consolidated OS X instructions to the shell script, removed step-by-step instructions from README.md
2017-03-09 16:54:24 -08:00