Commit Graph

12 Commits

Author SHA1 Message Date
Mike Sperber 568c9b6f03
Update to current proto-lens packages. (#258) 2020-05-21 13:36:52 -07:00
Daniel YU 7316062c10 upgrade to ghc 8.6.4 (#237) 2019-04-11 19:27:15 -07:00
Christian Berentsen 61e58fd33f Use proto-lens* == 0.3.* (#212)
* Include more *_Fields modules
2018-09-04 10:44:52 -07:00
Jeroen Bransen d8bf349962 Create monad transformer version of Session (closes #153) (#154) 2017-10-02 16:33:49 -04: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 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
fkm3 b3c0997a8c Add support for logging to tensorboard (#74)
Add support for logging to tensorboard

Based on @gnezdo's internal version with some differences:

* Uses a pure haskell implementation of EventWriter instead of FFI.
* Special `buildAnd*` functions were dropped in favor of using
  `mergeAllSummaries :: Build SummaryTensor` with the normal
  `build` function.
2017-02-20 19:16:42 -08:00
Greg Steuck 2b5e41ffeb Make code --pedantic (#35)
* Enforce pedantic build mode in CI.
* Our imports drifted really far from where they should be.
2016-11-18 10:42:02 -08:00
Greg Steuck 0d4f5a9628 Added sessionTracer to log graph operations. (#26)
* Added TracingTest.
2016-11-14 15:14:51 -08:00
fkm3 630850c2d2 Add TensorFlow.Core module to start formalizing the exposed API (#17)
* Add TensorFlow.Core module to start formalizing the exposed API

* Refer to ops packages instead of modules
2016-11-10 09:47:41 -08:00
Greg Steuck 67690d1499 Initial commit 2016-10-24 19:26:42 +00:00