ocramz / ad-delcont

Reverse-mode automatic differentiation with delimited continuations
BSD 3-Clause "New" or "Revised" License
13 stars 2 forks source link

Define (**) for AD type explicitly #4

Closed msakai closed 1 year ago

msakai commented 1 year ago

Using implicit definition

x ** y = exp (log x * y)

makes its gradient to be

[(y * exp (log x * y)) / x, log x * exp (log x * y)]

and it's problematic when x = 0.

ocramz commented 1 year ago

Thank you!

ocramz commented 1 year ago

@msakai available from v 0.5 : https://hackage.haskell.org/package/ad-delcont-0.5.0.0