I have figured this out and I may answer the question myself. Hope it will offer some help for coming visitors.


The function that needs to be used is thnn_conv2d_backward 2, the method to find this is to read the derivatives.yaml 2. This file will record the forward and backward function.
{Note}  If you come to this and find that there is no THNN function, you may refer to this issue, because the pytorch teams are migrating to newer ATen function. The ATen is modern implementation for it.


The finput and fgradinput are just two temporary buffer. Which is cols and ones if you refer to Convolution implementation papers. Sorry I forget the paper’s name so you may search by your self.
The thing is, you don’t have to worry about these two, just pass empty tensor is enough, they serve as only a buffer. You may find the usage like
at::Tensor finput = at::empty({0},input.options()); 
at::Tensor fgrad_input = at::empty({0}, input.options());
auto kernel_size = weight.sizes().slice(2);
auto &&result = at::thnn_conv2d_backward(grad_output, input, weight,kernel_size , stride, padding, 
finput, fgrad_input, output_mask);



This could be find on derivatives.yaml as stated before.