1
0
mirror of https://github.com/tensorflow/haskell.git synced 2024-06-03 03:23:37 +02:00
Commit Graph

7 Commits

Author SHA1 Message Date
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
1539783ee5 Update type constraints to work around a ghc-8 bug. (#47)
Also removes all the ghc-8-specific logic in the .cabal files.

ghc-8 has issues with deeply nested tuples of constraints.  We can
work around it by:
- Changing TensorTypes to a regular class.  This required FlexibleContexts.
  (But we'll probably need it anyway when we support heterogeneous tensor
  lists.)
- Specializing NoneOf for long type lists.

For more details, see: https://ghc.haskell.org/trac/ghc/ticket/12175.

Also added 'directory' to tensorflow-core-ops' dependencies since it's used
in the Setup script.

One more step towards fixing #38.
2016-11-28 21:15:09 -08:00
Judah Jacobson
cec666e135 Fix Ref and Build semantics for generated code. (#37)
Also:
- Make TensorFlow.Ops.{variable,assign} be the Core generated versions.
- Make ops take "Shape" as mandatory input.
2016-11-21 10:19:15 -08:00
Noon van der Silk
69fdbf677f test case to show can't calculate grad for embedding (and associated fix) (#23)
* Fix for embedding gradient calculation

- Passes vectors instead of scalars to slice
- converts the numRows to a scalar
- add `toScalar` utility function
- minor change to test case so that it actually works

* added lib for testing helper functions

* add flatSlice function
2016-11-17 13:54:36 -08:00
Greg Steuck
4ec78a8fca Replaced topK with topKV2. (#21)
topK is obsolete and generating warnings.
2016-11-08 20:57:22 -08:00
fkm3
03a3a6d086 Misc MNIST example cleanup (#9)
* Use native oneHot op in the example code. It didn't exist when this was originally written.
* Misc cleanup in MNIST example

- Use unspecified dimension for batch size in model. This simplifies the
  code for the test set.
- Move error rate calculation into model.
2016-10-26 11:14:38 -07:00
Greg Steuck
67690d1499 Initial commit 2016-10-24 19:26:42 +00:00