💣 Machine learning which might blow up in your face 💣
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Bump hedgehog and criterion

+30 -39
+2 -2
grenade.cabal
··· 150 150 build-depends: 151 151 base >= 4.8 && < 5 152 152 , grenade 153 - , hedgehog >= 0.4 && < 0.5 153 + , hedgehog >= 0.5 && < 0.6 154 154 , hmatrix 155 155 , mtl 156 156 , singletons ··· 178 178 build-depends: 179 179 base >= 3 && < 5 180 180 , bytestring == 0.10.* 181 - , criterion == 1.1.* 181 + , criterion >= 1.1 && < 1.3 182 182 , grenade 183 183 , hmatrix 184 184
+3 -4
test/Test/Grenade/Layers/Convolution.hs
··· 39 39 , KnownNat strideColumns 40 40 , KnownNat kernelFlattened 41 41 , kernelFlattened ~ (kernelRows * kernelColumns * channels) 42 - , Monad m 43 - ) => Gen.Gen m (Convolution channels filters kernelRows kernelColumns strideRows strideColumns) 42 + ) => Gen (Convolution channels filters kernelRows kernelColumns strideRows strideColumns) 44 43 genConvolution = Convolution <$> uniformSample <*> uniformSample 45 44 46 - genOpaqueOpaqueConvolution :: Monad m => Gen m OpaqueConvolution 45 + genOpaqueOpaqueConvolution :: Gen OpaqueConvolution 47 46 genOpaqueOpaqueConvolution = do 48 47 channels <- genNat 49 48 filters <- genNat ··· 59 58 p2 = natDict pkc 60 59 p3 = natDict pch 61 60 in case p1 %* p2 %* p3 of 62 - Dict -> OpaqueConvolution <$> (genConvolution :: Monad n => Gen n (Convolution ch fl kr kc sr sc)) 61 + Dict -> OpaqueConvolution <$> (genConvolution :: Gen (Convolution ch fl kr kc sr sc)) 63 62 64 63 prop_conv_net_witness = property $ 65 64 blindForAll genOpaqueOpaqueConvolution >>= \onet ->
+1 -1
test/Test/Grenade/Layers/FullyConnected.hs
··· 26 26 instance Show OpaqueFullyConnected where 27 27 show (OpaqueFullyConnected n) = show n 28 28 29 - genOpaqueFullyConnected :: Monad m => Gen m OpaqueFullyConnected 29 + genOpaqueFullyConnected :: Gen OpaqueFullyConnected 30 30 genOpaqueFullyConnected = do 31 31 input :: Integer <- choose 2 100 32 32 output :: Integer <- choose 1 100
+1 -2
test/Test/Grenade/Layers/Pooling.hs
··· 13 13 import Grenade.Layers.Pooling 14 14 15 15 import Hedgehog 16 - import qualified Hedgehog.Gen as Gen 17 16 18 17 import Test.Hedgehog.Compat 19 18 ··· 23 22 instance Show OpaquePooling where 24 23 show (OpaquePooling n) = show n 25 24 26 - genOpaquePooling :: Monad m => Gen.Gen m OpaquePooling 25 + genOpaquePooling :: Gen OpaquePooling 27 26 genOpaquePooling = do 28 27 Just kernelHeight <- someNatVal <$> choose 2 15 29 28 Just kernelWidth <- someNatVal <$> choose 2 15
+3 -3
test/Test/Grenade/Network.hs
··· 53 53 -- 54 54 -- This is slightly insane for a few reasons. Everything must be wrapped up 55 55 -- in a SomeNetwork. 56 - genNetwork :: Monad m => Gen.Gen m SomeNetwork 56 + genNetwork :: Gen SomeNetwork 57 57 genNetwork = 58 58 Gen.recursive Gen.choice [ 59 59 do SomeSing ( r :: Sing final ) <- genShape ··· 438 438 result ~~~ expected 439 439 440 440 -- Make a shape where all are 0 except for 1 value, which is 1. 441 - oneUp :: forall shape m. ( Monad m, SingI shape ) => Gen.Gen m (S shape) 441 + oneUp :: forall shape. ( SingI shape ) => Gen (S shape) 442 442 oneUp = 443 443 case ( sing :: Sing shape ) of 444 444 D1Sing SNat -> ··· 482 482 maxVal ( S2D x ) = norm_Inf x 483 483 maxVal ( S3D x ) = norm_Inf x 484 484 485 - (~~~) :: (Monad m, HasCallStack) => Double -> Double -> Test m () 485 + (~~~) :: (Monad m, HasCallStack) => Double -> Double -> PropertyT m () 486 486 (~~~) x y = 487 487 if abs (x - y) < 2e-5 then 488 488 success
+2 -3
test/Test/Grenade/Recurrent/Layers/LSTM.hs
··· 11 11 module Test.Grenade.Recurrent.Layers.LSTM where 12 12 13 13 import Hedgehog 14 - import qualified Hedgehog.Gen as Gen 15 14 import Hedgehog.Internal.Source 16 15 import Hedgehog.Internal.Show 17 16 import Hedgehog.Internal.Property ( failWith, Diff (..) ) ··· 29 28 import qualified Test.Grenade.Recurrent.Layers.LSTM.Reference as Reference 30 29 import Test.Hedgehog.Hmatrix 31 30 32 - genLSTM :: forall i o m. (KnownNat i, KnownNat o, Monad m) => Gen.Gen m (LSTM i o) 31 + genLSTM :: forall i o. (KnownNat i, KnownNat o) => Gen (LSTM i o) 33 32 genLSTM = do 34 33 let w = uniformSample 35 34 u = uniformSample ··· 103 102 refGradients = Reference.runLSTMbackOnCell refInput refNet refCell 104 103 in toList refGradients ~~~ H.toList (S.extract actualGradients) 105 104 106 - (~~~) :: (Monad m, Eq a, Ord a, Num a, Fractional a, Show a, HasCallStack) => [a] -> [a] -> Test m () 105 + (~~~) :: (Monad m, Eq a, Ord a, Num a, Fractional a, Show a, HasCallStack) => [a] -> [a] -> PropertyT m () 107 106 (~~~) x y = 108 107 if all (< 1e-8) (zipWith (-) x y) then 109 108 success
+8 -16
test/Test/Hedgehog/Compat.hs
··· 7 7 , forAllRender 8 8 )where 9 9 10 - import Control.Monad.Trans.Class (MonadTrans(..)) 11 - 10 + import Hedgehog (Gen) 12 11 import qualified Hedgehog.Gen as Gen 13 12 import qualified Hedgehog.Range as Range 14 13 import Hedgehog.Internal.Property 15 14 import Hedgehog.Internal.Source 16 - import Hedgehog.Internal.Show 17 15 18 16 (...) :: (c -> d) -> (a -> b -> c) -> a -> b -> d 19 17 (...) = (.) . (.) 20 18 {-# INLINE (...) #-} 21 19 22 - choose :: ( Monad m, Integral a ) => a -> a -> Gen.Gen m a 20 + choose :: ( Integral a ) => a -> a -> Gen a 23 21 choose = Gen.integral ... Range.constant 24 22 25 - blindForAll :: Monad m => Gen.Gen m a -> Test m a 26 - blindForAll = Test . lift . lift 23 + blindForAll :: Monad m => Gen a -> PropertyT m a 24 + blindForAll = forAllWith (const "blind") 27 25 28 - semiBlindForAll :: (Monad m, Show a, HasCallStack) => Gen.Gen m a -> Test m a 29 - semiBlindForAll gen = do 30 - x <- Test . lift $ lift gen 31 - withFrozenCallStack $ annotate (showPretty x) 32 - return x 26 + semiBlindForAll :: (Monad m, Show a, HasCallStack) => Gen a -> PropertyT m a 27 + semiBlindForAll = forAllWith (const "blind") 33 28 34 - forAllRender :: (Monad m, HasCallStack) => ( a -> String ) -> Gen.Gen m a -> Test m a 35 - forAllRender render gen = do 36 - x <- Test . lift $ lift gen 37 - withFrozenCallStack $ footnote (render x) 38 - return x 29 + forAllRender :: (Monad m, HasCallStack) => ( a -> String ) -> Gen a -> PropertyT m a 30 + forAllRender render gen = forAllWith render gen
+4 -3
test/Test/Hedgehog/Hmatrix.hs
··· 9 9 import Data.Singletons 10 10 import Data.Singletons.TypeLits 11 11 12 + import Hedgehog (Gen) 12 13 import qualified Hedgehog.Gen as Gen 13 14 import qualified Hedgehog.Range as Range 14 15 15 16 import qualified Numeric.LinearAlgebra.Static as HStatic 16 17 17 - randomVector :: forall m n. ( Monad m, KnownNat n ) => Gen.Gen m (HStatic.R n) 18 + randomVector :: forall n. ( KnownNat n ) => Gen (HStatic.R n) 18 19 randomVector = (\s -> HStatic.randomVector s HStatic.Uniform * 2 - 1) <$> Gen.int Range.linearBounded 19 20 20 - uniformSample :: forall mm m n. ( Monad mm, KnownNat m, KnownNat n ) => Gen.Gen mm (HStatic.L m n) 21 + uniformSample :: forall m n. ( KnownNat m, KnownNat n ) => Gen (HStatic.L m n) 21 22 uniformSample = (\s -> HStatic.uniformSample s (-1) 1 ) <$> Gen.int Range.linearBounded 22 23 23 24 -- | Generate random data of the desired shape 24 - genOfShape :: forall m x. ( Monad m, SingI x ) => Gen.Gen m (S x) 25 + genOfShape :: forall x. ( SingI x ) => Gen (S x) 25 26 genOfShape = 26 27 case (sing :: Sing x) of 27 28 D1Sing l ->
+6 -5
test/Test/Hedgehog/TypeLits.hs
··· 13 13 #endif 14 14 import Data.Singletons 15 15 16 + import Hedgehog (Gen) 16 17 import qualified Hedgehog.Gen as Gen 17 18 18 19 import Grenade ··· 21 22 import GHC.TypeLits.Witnesses 22 23 import Test.Hedgehog.Compat 23 24 24 - genNat :: Monad m => Gen.Gen m SomeNat 25 + genNat :: Gen SomeNat 25 26 genNat = do 26 27 Just n <- someNatVal <$> choose 1 10 27 28 return n ··· 32 33 type Shape' = Shape 33 34 #endif 34 35 35 - genShape :: Monad m => Gen.Gen m (SomeSing Shape') 36 + genShape :: Gen (SomeSing Shape') 36 37 genShape 37 38 = Gen.choice [ 38 39 genD1 ··· 40 41 , genD3 41 42 ] 42 43 43 - genD1 :: Monad m => Gen.Gen m (SomeSing Shape') 44 + genD1 :: Gen (SomeSing Shape') 44 45 genD1 = do 45 46 n <- genNat 46 47 return $ case n of 47 48 SomeNat (_ :: Proxy x) -> SomeSing (sing :: Sing ('D1 x)) 48 49 49 - genD2 :: Monad m => Gen.Gen m (SomeSing Shape') 50 + genD2 :: Gen (SomeSing Shape') 50 51 genD2 = do 51 52 n <- genNat 52 53 m <- genNat 53 54 return $ case (n, m) of 54 55 (SomeNat (_ :: Proxy x), SomeNat (_ :: Proxy y)) -> SomeSing (sing :: Sing ('D2 x y)) 55 56 56 - genD3 :: Monad m => Gen.Gen m (SomeSing Shape') 57 + genD3 :: Gen (SomeSing Shape') 57 58 genD3 = do 58 59 n <- genNat 59 60 m <- genNat