How does grad treat self? #9648
Unanswered
dieterichlawson
asked this question in
Q&A
Replies: 1 comment
-
Jax use tracing. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I was playing around with trying to differentiate functions that accept a
self
parameter because they're defined on objects. I was expectinggrad
to fail in this case, but it seems to ignoreself
entirely. Here is some example code that is trying to compute the gradient ofsum(W @ x)
with respect to W:grad
does not seeself
as an argument and instead treatsx
as the first argument, resulting in it returning the gradient ofsum(W @ x)
with respect to x. What exactly is going on here? I looked in the code forgrad
andvalue_and_grad
and was unable to figure out where this behavior was implemented.Beta Was this translation helpful? Give feedback.
All reactions