Skip to content

Commit

Permalink
tests pass now
Browse files Browse the repository at this point in the history
  • Loading branch information
mstksg committed May 3, 2018
1 parent 40dd2ec commit 1377ed3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
19 changes: 10 additions & 9 deletions src/Numeric/LinearAlgebra/Static/Backprop.hs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ import qualified Data.Vector.Generic.Sized as SVG
import qualified Data.Vector.Sized as SV
import qualified Data.Vector.Storable.Sized as SVS
import qualified Numeric.Backprop as BBP
import qualified Numeric.Backprop.Explicit as BE
import qualified Numeric.LinearAlgebra as HU
import qualified Numeric.LinearAlgebra.Static as H
import qualified Numeric.LinearAlgebra.Static.Vector as H
Expand Down Expand Up @@ -1132,16 +1133,16 @@ sumElements = liftOp1 . op1 $ \x ->
-- If there are missing items, they are treated as zero.
extractV
:: forall t s q.
( Reifies q W
, H.Sized t s HU.Vector
, Num s
( H.Sized t s HU.Vector
, HU.Konst t Int HU.Vector
, HU.Container HU.Vector t
, Num (HU.Vector t)
, Backprop t
, Backprop s
, Reifies q W
)
=> BVar q s
-> BVar q (HU.Vector t)
extractV = liftOp1 . op1 $ \x ->
extractV = BBP.liftOp1 . op1 $ \x ->
let n = H.size x
in ( H.extract x
, \d -> let m = HU.size d
Expand All @@ -1157,16 +1158,16 @@ extractV = liftOp1 . op1 $ \x ->
-- If there are missing items, they are treated as zero.
extractM
:: forall t s q.
( Reifies q W
, H.Sized t s HU.Matrix
, Num s
( H.Sized t s HU.Matrix
, Backprop s
, HU.Konst t (Int, Int) HU.Matrix
, HU.Container HU.Matrix t
, Num (HU.Matrix t)
, Reifies q W
)
=> BVar q s
-> BVar q (HU.Matrix t)
extractM = liftOp1 . op1 $ \x ->
extractM = BE.liftOp1 BE.addFunc (BE.ZF (HU.cmap (const 0))) . op1 $ \x -> -- TODO: can be BBP once instances are in Numeric.LinearAlgebra.Backprop
let (xI,xJ) = H.size x
in ( H.extract x
, \d -> let (dI,dJ) = HU.size d
Expand Down
2 changes: 1 addition & 1 deletion test/Nudge.hs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ instance (Testing a, Testing b) => Testing (a, b) where
)
genTest = (,) <$> genTest <*> genTest

instance (Testing a, Testing b, Testing c, Num a, Num b, Num c) => Testing (a, b, c) where
instance (Testing a, Testing b, Testing c) => Testing (a, b, c) where
type TIx (a, b, c) = Either (TIx a) (Either (TIx b) (TIx c))
allIx (x, y, z) = (Left <$> allIx x)
++ (Right . Left <$> allIx y)
Expand Down

0 comments on commit 1377ed3

Please sign in to comment.