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