packages feed

backprop 0.2.6.0 → 0.2.6.1

raw patch · 4 files changed

+31/−12 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Numeric.Backprop.Op: instance (Data.Vinyl.Core.RecApplicative as, Data.Vinyl.TypeLevel.AllConstrained GHC.Float.Floating as, Data.Vinyl.TypeLevel.AllConstrained GHC.Real.Fractional as, Data.Vinyl.TypeLevel.AllConstrained GHC.Num.Num as, Data.Vinyl.Core.RPureConstrained GHC.Num.Num as, GHC.Float.Floating a) => GHC.Float.Floating (Numeric.Backprop.Op.Op as a)
+ Numeric.Backprop.Op: instance (Data.Vinyl.Core.RPureConstrained GHC.Num.Num as, GHC.Float.Floating a) => GHC.Float.Floating (Numeric.Backprop.Op.Op as a)

Files

CHANGELOG.md view
@@ -1,6 +1,16 @@ Changelog ========= +Version 0.2.6.1+---------------++*August 6, 2018*++<https://github.com/mstksg/backprop/releases/tag/v0.2.6.1>++*   Removed redundant constraints from `Floating` instance of `Op`.+*   Fixed lower bound for *vinyl* dependency.+ Version 0.2.6.0 --------------- 
backprop.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 5fe92f47f037a2d14b0df727ed7cb1213b58e39938cf6b691b376d5caa565d5d+-- hash: 009a268e1d551f52673b7339f93986c16870d9402a854ad8157d133450ef7591  name:           backprop-version:        0.2.6.0+version:        0.2.6.1 synopsis:       Heterogeneous automatic differentation description:    Write your functions to compute your result, and the library will                 automatically generate functions to compute your gradient.@@ -63,7 +63,7 @@     , reflection     , transformers     , vector-    , vinyl >=0.9+    , vinyl >=0.9.1   exposed-modules:       Numeric.Backprop       Numeric.Backprop.Class
doc/01-getting-started.md view
@@ -44,13 +44,13 @@ They can be run with `evalBP`:  ```haskell eval-evalBP myFunc (9 :: Double)+evalBP myFunc 9 :: Double ```  And...the twist?  You can also get the gradient of your functions!  ```haskell eval-gradBP myFunc (9 :: Double)+gradBP myFunc 9 :: Double ```  We can even be cute with with the *[simple-reflect][]* library:@@ -58,16 +58,20 @@ [simple-reflect]: https://hackage.haskell.org/package/simple-reflect  ```haskell top hide+instance Backprop Expr where+    zero = zeroNum+    add  = addNum+    one  = oneNum instance AskInliterate Expr ```  ```haskell eval-evalBP myFunc (x :: Expr)+evalBP myFunc x :: Expr ```   ```haskell eval-gradBP myFunc (x :: Expr)+gradBP myFunc x :: Expr ```  
src/Numeric/Backprop/Op.hs view
@@ -84,7 +84,6 @@ import           Data.List import           Data.Type.Util import           Data.Vinyl.Core-import           Data.Vinyl.TypeLevel import           Lens.Micro import           Lens.Micro.Extras import qualified Data.Vinyl.Recursive  as VR@@ -330,7 +329,10 @@ -- -- @since 0.1.3.0 noGrad1 :: (a -> b) -> Op '[a] b-noGrad1 f = op1 (\x -> (f x, \_ -> error "noGrad1: no gradient defined"))+noGrad1 f = op1 $ \x ->+    ( f x+    , \_ -> errorWithoutStackTrace "Numeric.Backprop.Op.noGrad1: no gradient defined"+    ) {-# INLINE noGrad1 #-}  -- | Create an 'Op' with no gradient.  Can be evaluated with 'evalOp',  but@@ -347,7 +349,10 @@ -- -- @since 0.1.3.0 noGrad :: (Rec Identity as -> b) -> Op as b-noGrad f = Op (\xs -> (f xs, \_ -> error "noGrad: no gradient defined"))+noGrad f = Op $ \xs ->+    ( f xs+    , \_ -> errorWithoutStackTrace "Numeric.Backprop.Op.noGrad: no gradient defined"+    ) {-# INLINE noGrad #-}  -- | An 'Op' that just returns whatever it receives.  The identity@@ -423,7 +428,7 @@     => a     -> Op as a opConst x = Op $ const-    (x , const $ rpureConstrained @Num 0)+    (x, const $ rpureConstrained @Num 0) {-# INLINE opConst #-}  -- | Create an 'Op' that takes no inputs and always returns the given@@ -566,7 +571,7 @@     fromRational x = opConst (fromRational x)     {-# INLINE fromRational #-} -instance (RecApplicative as, AllConstrained Floating as, AllConstrained Fractional as, AllConstrained Num as, RPureConstrained Num as, Floating a) => Floating (Op as a) where+instance (RPureConstrained Num as, Floating a) => Floating (Op as a) where     pi            = opConst pi     {-# INLINE pi #-}     exp   o       = composeOp (o  :& RNil)       expOp