Is there any good documentation about torch::autograd::FunctionTask?
I don’t think there is any. This is an internal class.
Where did you encountered it? What do you want to do with it?
Thank you for commenting.
I try to implement a function for forward/backward.
I met following error message.
RuntimeError: Function TestBackward returned an invalid gradient at index 0 - expected shape  but got [1, 1000]
Then I investigate it and found it seems InputBuffer in FunctionTask is not expected shape. (specifically metadata.shape() and grads[i].sizes() inconsistency.)
Is there any tips to fix InputBuffer tensor size?
The InputBuffer size will be the size of what the previous function returned.
Make sure that the gradient you return is exactly the same as the input it is for: 1x1000 is not the same as 1000.