Skip to content

RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn #152

Discussion options

You must be logged in to vote

Another guess: when you build your input in C++, are you explicitly providing edge_vectors? That would break the autograd graph and give exactly this error. The network should only be provided with pos, edge_index, an edge_cell_shift (in the periodic case) so that it can build edge_vectors out of pos so that taking grad w.r.t. pos gives the right answer.

Even if this isn't your bug, it is probably something I should try to make an error rather than a silent failure... if that's possible.

Replies: 5 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@isabel-s-rosa
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@isabel-s-rosa
Comment options

@Linux-cpp-lisp
Comment options

Comment options

You must be logged in to vote
1 reply
@isabel-s-rosa
Comment options

Answer selected by isabel-s-rosa
Comment options

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