diff options
author | Tom Smeding <t.j.smeding@uu.nl> | 2025-02-20 22:41:53 +0100 |
---|---|---|
committer | Tom Smeding <t.j.smeding@uu.nl> | 2025-02-20 22:41:53 +0100 |
commit | 20754e0ae9226f658590f46105399aee5c0dcee2 (patch) | |
tree | 261be51f07c530d09665708fb149dd241c296b70 /test | |
parent | fe3132304b6c25e5bebc9fb327e3ea5d6018be7a (diff) |
Try debugging crash
Diffstat (limited to 'test')
-rw-r--r-- | test/Main.hs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test/Main.hs b/test/Main.hs index aade6a5..86b6011 100644 --- a/test/Main.hs +++ b/test/Main.hs @@ -1,13 +1,26 @@ {-# LANGUAGE TypeApplications #-} module Main where +import qualified Data.Vector as V +import Hedgehog import Test.Tasty +import Test.Tasty.Hedgehog import Test.Tasty.HUnit import Numeric.ADDual +import Numeric.ADDual.Examples main :: IO () main = defaultMain $ testGroup "Tests" [testCase "product [1..5]" $ - gradient' @Double product [1..5] 1 @?= (120, [120, 60, 40, 30, 24])] + gradient' @Double product [1..5] 1 @?= (120, [120, 60, 40, 30, 24]) + ,testCase "neural one" $ + let problem = FNeural + [(V.replicate 6 0.0, V.replicate 6 0.0), (V.replicate 24 0.0, V.replicate 4 0.0)] + (V.replicate 1 0.0) + in fst (gradient' @Double fneural problem 1) @?= 0.0 + ,testProperty "neural run" $ property $ do + input <- forAll genNeuralInput + let (res, _grad) = gradient' fneural input 1 + res === fneural input] |