1
0
Fork 0
mirror of https://github.com/tensorflow/haskell.git synced 2024-11-23 03:19:44 +01:00
tensorflow-haskell/tensorflow-ops/tests
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
..
ArrayOpsTest.hs Refactor OpGen. (#36) 2016-11-20 10:00:22 -08:00
BuildTest.hs Introduce a MonadBuild class, and remove buildAnd. (#83) 2017-03-18 12:08:53 -07:00
DataFlowOpsTest.hs Introduce a MonadBuild class, and remove buildAnd. (#83) 2017-03-18 12:08:53 -07:00
EmbeddingOpsTest.hs Introduce a MonadBuild class, and remove buildAnd. (#83) 2017-03-18 12:08:53 -07:00
FeedFetchBench.hs Support fetching storable vectors + use them in benchmark (#50) 2016-12-14 18:53:06 -08:00
GradientTest.hs Introduce a MonadBuild class, and remove buildAnd. (#83) 2017-03-18 12:08:53 -07:00
MiscTest.hs Make code --pedantic (#35) 2016-11-18 10:42:02 -08:00
OpsTest.hs Introduce a MonadBuild class, and remove buildAnd. (#83) 2017-03-18 12:08:53 -07:00
RegressionTest.hs Introduce a MonadBuild class, and remove buildAnd. (#83) 2017-03-18 12:08:53 -07:00
TracingTest.hs Introduce a MonadBuild class, and remove buildAnd. (#83) 2017-03-18 12:08:53 -07:00
TypesTest.hs Support fetching storable vectors + use them in benchmark (#50) 2016-12-14 18:53:06 -08:00