(weight, bias, x)
| 288 | # and then computing the Jacobian of that function: |
| 289 | |
| 290 | def predict_with_output_summed(weight, bias, x): |
| 291 | return predict(weight, bias, x).sum(0) |
| 292 | |
| 293 | batch_jacobian1 = jacrev(predict_with_output_summed, argnums=2)(weight, bias, x).movedim(1, 0) |
| 294 | assert torch.allclose(batch_jacobian0, batch_jacobian1) |