Do we support tf.GradientTape?

31 views
Skip to first unread message

Jim Clarke

unread,
Apr 8, 2021, 11:36:05 AM4/8/21
to SIG JVM
tf.GradientTape
"Record operations for automatic differentiation."

Ryan Nett

unread,
Apr 8, 2021, 4:25:10 PM4/8/21
to SIG JVM, jimcla...@gmail.com
(Reposting cause I used the wrong reply)

Not yet, that's the same thing as the eager gradient support that's been mentioned.  We definitely plan to.  I'm not sure if there's enough stuff in the C API to use it yet.  There's C++ classes, but I wasn't able to generate JavaCPP code for it (although someone who knows it better may be able to, I think Karl was going to look at it).  I don't think the gradient backend is fully implemented yet either, there's no global registration yet afaik.

Samuel Audet

unread,
Apr 9, 2021, 12:54:39 PM4/9/21
to Ryan Nett, SIG JVM, Jim Clarke
Ok, today, I've spend the day mapping that experimental API:
https://github.com/tensorflow/java/pull/283
But it does feel really really experimental. It's not used at all by the
Python API, and it's not even built into the native library itself, yet.
I had to compile gradients.cc along the JNI code just to get it to link:
https://github.com/saudet/tensorflow-java/blob/add-gradient-tape/tensorflow-core/tensorflow-core-api/pom.xml#L341

Samuel

Ryan Nett

unread,
Apr 9, 2021, 1:19:48 PM4/9/21
to SIG JVM, samuel...@gmail.com, jimcla...@gmail.com, Ryan Nett
From what I can tell, the infrastructure is there and is used from Python (here), but the actual gradients are still being moved (see the RFC).

The gradients are still registered manually for tests (see here), I don't think there's any centralized C++ level registry yet.

Reply all
Reply to author
Forward
0 new messages