From 20754e0ae9226f658590f46105399aee5c0dcee2 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Thu, 20 Feb 2025 22:41:53 +0100 Subject: Try debugging crash --- test/Main.hs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'test/Main.hs') 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] -- cgit v1.2.3-70-g09d2