Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
a9b87c9a
Unverified
Commit
a9b87c9a
authored
Nov 09, 2020
by
hroken
Committed by
GitHub
Nov 09, 2020
Browse files
Bug-fixed for _compute_hessian in Pytorch NAS Darts (#3058)
Co-authored-by:
huwei
<
huw@abc.com
>
parent
16dc45b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
nni/algorithms/nas/pytorch/darts/trainer.py
nni/algorithms/nas/pytorch/darts/trainer.py
+1
-1
No files found.
nni/algorithms/nas/pytorch/darts/trainer.py
View file @
a9b87c9a
...
@@ -210,5 +210,5 @@ class DartsTrainer(Trainer):
...
@@ -210,5 +210,5 @@ class DartsTrainer(Trainer):
dalphas
.
append
(
torch
.
autograd
.
grad
(
loss
,
self
.
mutator
.
parameters
()))
dalphas
.
append
(
torch
.
autograd
.
grad
(
loss
,
self
.
mutator
.
parameters
()))
dalpha_pos
,
dalpha_neg
=
dalphas
# dalpha { L_trn(w+) }, # dalpha { L_trn(w-) }
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
return
hessian
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment