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

14 commits

Author SHA1 Message Date
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
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
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
Greg Steuck
5414f197a1 Update to 1.0 release and newest proto-lens (#77)
* Update from rc to full 1.0 release.
* Switch to proto-lens 0.1.0.5.
2017-02-22 15:24:45 -08:00
Judah Jacobson
dca49d8993 Update Mac build instructions. (#73)
- Use the prebuilt binaries/headers for TF 1.0rc.
- Add instructions and stack.yaml config for tensorflow-records's dependency on
  snappy.
2017-02-12 22:17:38 -08:00
Greg Steuck
72631cb9f3 Uprev to TF 1.0rc1. (#69)
* Download protoc and libtensorflow instead of running bazel.
* Explicitly set permissions of protoc.
2017-02-09 14:20:43 -08:00
Judah Jacobson
4b5a57152f Add instructions to download protoc for building on Mac. (#65) 2017-01-23 09:12:09 -08:00
fkm3
4fb68f3aa3 Add example to README + make haddock link more prominent (#60) 2017-01-16 20:44:45 -08:00
Judah Jacobson
5fa1d2ba8f Update OS X instructions (#42) to not require a separate ".so" file. (#44)
The right approach is to run `install_name_tool` on the library after renaming
its extension from ".so" to ".dylib".
2016-11-22 16:15:34 -08:00
Judah Jacobson
eb7e78d60d Add instructions to symlink ".so" to ".dylib" on OS X (#42). (#43)
I'm not sure why, but in some cases it seems linking only works if *both* the
.so and the .dylib are present in /usr/local/lib.  This may be due to a quirk
of how Bazel builds the library, and/or how ghc/stack load the library.
2016-11-22 08:34:59 -08:00
Greg Steuck
9f2f4e2877 Fixed CI and added indicator. (#15)
* Sorted test names.

* Don't require a terminal to run tests.

Should resolve "the input device is not a TTY" problem with Jenkins.

* Added build indicator to README.md.

* Fixed up URL.
2016-10-28 18:08:32 -07:00
Judah Jacobson
54eddcc6bd Add instructions for building on Mac OS X. (#8)
* Add instructions for building on Mac OS X.
* Include /usr/local/lib directly in stack.yaml.
2016-10-26 11:13:42 -07:00
Greg Steuck
11fe77df7a Update README.md
Close #4
2016-10-25 09:53:35 -07:00
Greg Steuck
67690d1499 Initial commit 2016-10-24 19:26:42 +00:00