When creating autograph extensions in C++ by subclassing the torch::autograd::Function…
From the comments here, it seems that only direct Variable arguments are registered in the graph.
Is there any way I could pass a variable_list here? We are building a general interface for libtorch in R, and we only know the number of Variable argument at runtime. I see that python uses a different implementation here that uses a variable_list.
Would you give us some pointer on how to implement the node by hand?
Would it just work If I implement a subclass of Node and implement it’s methods like:
The important bit is that Nodes are only applied. So you need one for the forward and one for the backward.
And you should use the wrap_outputs util from the functions/utils.cpp to properly set up the graph on your outputs before returning them.
Note that if you do inplace or views there is more stuff that you need to do (let me know if you need these).