Numeric.AD and typing problem

丶灬走出姿态 提交于 2019-12-01 16:31:34

My guess is you are forgetting to apply lift to convert an Expr to an AD s Expr.

If you are interested in using the ad package for symbolic differentiation. Lennart Augustsson's traced package works well.

When GHC cannot deduce a type equality signature for a valid function, as in your case, the solution is to give the function a type signature. I do not know the interface to this library. However, my guess is that the correct signature is calcGrad1 :: (Num a, Floating a) => Expr a -> [Expr a].

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!