@@ -9,9 +9,6 @@
9{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
9{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
10module Test.Grenade.Layers.Nonlinear where
10module Test.Grenade.Layers.Nonlinear where
13−import Control.Monad.Trans.Class (MonadTrans(..))
15import Data.Singletons
12import Data.Singletons
17#if __GLASGOW_HASKELL__ < 800
14#if __GLASGOW_HASKELL__ < 800
@@ -22,18 +19,13 @@ import Grenade
22import GHC.TypeLits
19import GHC.TypeLits
24import Hedgehog
21import Hedgehog
25−import Hedgehog.Internal.Property ( Test (..) )
23+import Test.Jack.Compat
27import Test.Jack.Hmatrix
24import Test.Jack.Hmatrix
28import Test.Jack.TypeLits
25import Test.Jack.TypeLits
30import Numeric.LinearAlgebra.Static ( norm_Inf )
27import Numeric.LinearAlgebra.Static ( norm_Inf )
32−-- | Generates a random input for the test by running the provided generator.
34−blindForAll :: Monad m => Gen m a -> Test m a
35−blindForAll = Test . lift . lift
37prop_sigmoid_grad :: Property
29prop_sigmoid_grad :: Property
38prop_sigmoid_grad = property $
30prop_sigmoid_grad = property $
39 blindForAll genShape >>= \case
31 blindForAll genShape >>= \case
@@ -66,9 +58,9 @@ prop_tanh_grad = property $
67prop_softmax_grad :: Property
59prop_softmax_grad :: Property
68prop_softmax_grad = property $
60prop_softmax_grad = property $
69− forAll genNat >>= \case
61+ blindForAll genNat >>= \case
70 (SomeNat (_ :: Proxy s)) ->
62 (SomeNat (_ :: Proxy s)) ->
71− forAll genOfShape >>= \(ds :: S ('D1 s)) ->
63+ blindForAll genOfShape >>= \(ds :: S ('D1 s)) ->
72 let (tape, f :: S ('D1 s)) = runForwards Relu ds
64 let (tape, f :: S ('D1 s)) = runForwards Relu ds
73 ((), ret :: S ('D1 s)) = runBackwards Relu tape (1 :: S ('D1 s))
65 ((), ret :: S ('D1 s)) = runBackwards Relu tape (1 :: S ('D1 s))
74 (_, numer :: S ('D1 s)) = runForwards Relu (ds + 0.0001)
66 (_, numer :: S ('D1 s)) = runForwards Relu (ds + 0.0001)