hasktorch-indef-0.0.1.0: Core Hasktorch abstractions wrapping FFI bindings

Copyright(c) Sam Stites 2017
LicenseBSD3
Maintainersam@stites.io
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Torch.Indef.Static.NN.Backprop

Contents

Description

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

Orphan instances

Dimensions d => Backprop (Tensor d) Source # 
Instance details

Methods

zero :: Tensor d -> Tensor d

add :: Tensor d -> Tensor d -> Tensor d

one :: Tensor d -> Tensor d