Copyright | (c) Sam Stites 2017 |
---|---|
License | BSD3 |
Maintainer | sam@stites.io |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Backprop helper instances for static tensors, as well as any helper functions that might work well with backprop.
Synopsis
- unsqueeze1dBP :: forall s d rs ls n. Reifies s W => All Dimensions '[d, rs ++ ('[1] ++ ls)] => '(rs, ls) ~ SplitAt n d => '(rs, 1 :+ ls) ~ SplitAt n (rs ++ ('[1] ++ ls)) => (rs ++ ls) ~ d => Dim n -> BVar s (Tensor d) -> BVar s (Tensor (rs ++ ('[1] ++ ls)))
- squeeze1dBP :: forall s d rs ls n. Reifies s W => All Dimensions '[d, rs ++ ls] => All KnownDim '[n] => '(rs, 1 :+ ls) ~ SplitAt n d => d ~ (Take n (rs ++ ls) ++ ('[1] ++ Drop n (rs ++ ls))) => Dim n -> BVar s (Tensor d) -> BVar s (Tensor (rs ++ ls))
- flattenBatchIO :: forall d bs. (All KnownDim '[Product d, bs], All Dimensions '[bs :+ d, d]) => Product (bs :+ d) ~ Product '[bs, Product d] => Tensor (bs :+ d) -> IO (Tensor '[bs, Product d], Tensor '[bs, Product d] -> IO (Tensor (bs :+ d)))
Documentation
unsqueeze1dBP :: forall s d rs ls n. Reifies s W => All Dimensions '[d, rs ++ ('[1] ++ ls)] => '(rs, ls) ~ SplitAt n d => '(rs, 1 :+ ls) ~ SplitAt n (rs ++ ('[1] ++ ls)) => (rs ++ ls) ~ d => Dim n -> BVar s (Tensor d) -> BVar s (Tensor (rs ++ ('[1] ++ ls))) Source #
squeeze1dBP :: forall s d rs ls n. Reifies s W => All Dimensions '[d, rs ++ ls] => All KnownDim '[n] => '(rs, 1 :+ ls) ~ SplitAt n d => d ~ (Take n (rs ++ ls) ++ ('[1] ++ Drop n (rs ++ ls))) => Dim n -> BVar s (Tensor d) -> BVar s (Tensor (rs ++ ls)) Source #
Squeeze a dimension of size 1 out of the tensor
flattenBatchIO :: forall d bs. (All KnownDim '[Product d, bs], All Dimensions '[bs :+ d, d]) => Product (bs :+ d) ~ Product '[bs, Product d] => Tensor (bs :+ d) -> IO (Tensor '[bs, Product d], Tensor '[bs, Product d] -> IO (Tensor (bs :+ d))) Source #
A backprop-able flatten
operation with a batch dimension in IO