(y, z)
| 30 | |
| 31 | |
| 32 | def torch_xe_grad(y, z): |
| 33 | z = torch.autograd.Variable(torch.FloatTensor(z), requires_grad=True) |
| 34 | y = torch.LongTensor(y.argmax(axis=1)) |
| 35 | loss = F.cross_entropy(z, y, reduction="sum") |
| 36 | loss.backward() |
| 37 | grad = z.grad.numpy() |
| 38 | return grad |
| 39 | |
| 40 | |
| 41 | def torch_mse_grad(y, z, act_fn): |
nothing calls this directly
no test coverage detected