Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
Bug-fixed for _compute_hessian in Pytorch NAS Darts (#3058)
Browse files Browse the repository at this point in the history
Co-authored-by: huwei <[email protected]>
  • Loading branch information
hroken and hroken authored Nov 8, 2020
1 parent 16dc45b commit a9b87c9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nni/algorithms/nas/pytorch/darts/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,5 +210,5 @@ def _compute_hessian(self, backup_params, dw, trn_X, trn_y):
dalphas.append(torch.autograd.grad(loss, self.mutator.parameters()))

dalpha_pos, dalpha_neg = dalphas # dalpha { L_trn(w+) }, # dalpha { L_trn(w-) }
hessian = [(p - n) / 2. * eps for p, n in zip(dalpha_pos, dalpha_neg)]
hessian = [(p - n) / (2. * eps) for p, n in zip(dalpha_pos, dalpha_neg)]
return hessian

0 comments on commit a9b87c9

Please sign in to comment.