I am getting confused because when I checked the documentations behind
grad_input = torch.nn.grad.conv2d_input(input.shape, weight, grad_output)
grad_weight = torch.nn.grad.conv2d_weight(input, weight.shape, grad_output)

I came to know the input is the input to the (convolution) layer and [this] (https://github.com/pytorch/pytorch/blob/master/torch/nn/grad.py 1) code file also says that conv2d_weight function (line 170) computes the gradient of output of convolution with respect to the weight of the convolution.
So, where does the gradient of loss w.r.t. parameters is calculated if you take for example class LinearFunction(Function): in extending pytorch tutorial?