(xp)
| 47 | # by using a different unit vector each time. |
| 48 | |
| 49 | def compute_jac(xp): |
| 50 | jacobian_rows = [torch.autograd.grad(predict(weight, bias, xp), xp, vec)[0] |
| 51 | for vec in unit_vectors] |
| 52 | return torch.stack(jacobian_rows) |
| 53 | |
| 54 | xp = x.clone().requires_grad_() |
| 55 | unit_vectors = torch.eye(D) |
no test coverage detected