Skip to content

Directly obtaining gradient w.r.t a node's feature #9805

Answered by YiKangOY
YiKangOY asked this question in Q&A
Discussion options

You must be logged in to vote

Solved, when computing gradient, I guess data.x is as a whole node in the computation graph.
I take size_grad = grad(diff, x)[0], and then take the corresponding index from the gradient tensor, and it works now.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by YiKangOY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant