Mikolaj / horde-ad

Higher Order Reverse Derivatives Efficiently - Automatic Differentiation library based on the paper "Provably correct, asymptotically efficient, higher-order reverse-mode automatic differentiation"
BSD 3-Clause "New" or "Revised" License
34 stars 6 forks source link

Merge rev and srev functions without requiring the user to write more type application #92

Closed Mikolaj closed 1 year ago

Mikolaj commented 1 year ago

I tried that on branch

https://github.com/Mikolaj/horde-ad/tree/failed-rev-scalar-codomain

via type classes and failed. This may or may not be possible for deep or shallow reasons. My hunch is that it's not a GHC limitation, but either my brain's limitation or unavoidable ambiguity.

Function rev computes a gradient, assuming a tensor codomain, while srev assumes scalar (Double or Float) codomain.

Mikolaj commented 1 year ago

I think we gave up on supporting scalars at this point and instead we will try to optimize rank 0 tensors at some point. Closing.