haskell icon indicating copy to clipboard operation
haskell copied to clipboard

GradientTape usage in Haskell

Open johndoe888 opened this issue 6 years ago • 5 comments

GradientTape usage for reverse mode differentiation does not seem to be supported at the moment.

Any chance that it will be supported in the near future or was it left out intentionally?

Really looking forward to it as we want to move our Python test code to Haskell.

Any comment appreciated ;)

johndoe888 avatar Oct 31 '19 12:10 johndoe888

To the best of my understanding GradientTape is a feature of Eager mode (and TF2.0). We don't have anything like this in Haskell APIs. The gradients are computed automatically, but via a very different mechanism. Overall, the request seems infeasible.

blackgnezdo avatar Nov 01 '19 00:11 blackgnezdo

Thank you for the quick answer.

I was able to build and inspect a graph in TensorFlowHaskell, and also to compute gradients with forward-mode differentiation.

In the end I am not specifically interested in using GradientTape. I would like to use reverse-mode automatic differentiation (as seen here) to compute a gradient based on a graph (as seen here on page 11).

Is there an API to somehow achieve this, and if not, maybe you can explain in a little more detail why this is not possible?

johndoe888 avatar Nov 06 '19 08:11 johndoe888

Apologies, I didn't reply sooner to this comment.

Thanks for the references. I see you seem to be interested in applying the general idea.

I presume you've found that we have Gradient.hs? That's the closest I know to what you are looking for. If you have a specific proposal (PR) of the feature you need, please share it and we'll see how well it fits with what already exists.

blackgnezdo avatar Nov 12 '19 15:11 blackgnezdo

I'm reopening this issue and closing the other one which seems like a duplicate at this point.

blackgnezdo avatar Nov 12 '19 15:11 blackgnezdo

Hi. Our current Gradient module actually supports reverse mode differentiation, but does not support forward mode. Did you run into any problems using it?

fkm3 avatar Nov 12 '19 22:11 fkm3