Hi Alban,
Thank you for the fast response.
I think that you didn’t answer the question. And I see now that I’ve made a mistake when asking. I’ll edit that. The correct definition is the following:
The function f maps R^(nx2)xR^2 into R^n. And we differentiate only w.r.t the parameters (which are in R^2).
First, the Jacobian matrix is in fact of size [nb_out, nb_parameters] here as I am differentiating w.r.t the weights of the only layer. So it should be of size [100, 2]. I am sure of that as I am able to derive it on paper as well as without using autograd. Since v is in R^2, there is, in theory, no problem doing the operation Jv.
So what I want to do is to retrieve the Jacobian-vector product Jv. But there is some checking made to ensure that shapes of v and y (output) match. That makes no sense here.
On what concerns BCELoss, I’ve read the definition and ‘reduction = True’ is what I need since I need to play with reweighting the expected value of the likelihood (binary cross entropy if you prefer) but those details are irrelevant here.
Thank you in advance, being able to do that Jac-vector prod. could make my research way easier.