Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
23b892ca
Commit
23b892ca
authored
Aug 31, 2020
by
Yunho Jeon
Browse files
fix wrong order of hidden and cell state (fix #2839)
parent
bf8be1e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
src/sdk/pynni/nni/nas/pytorch/enas/mutator.py
src/sdk/pynni/nni/nas/pytorch/enas/mutator.py
+5
-5
No files found.
src/sdk/pynni/nni/nas/pytorch/enas/mutator.py
View file @
23b892ca
...
...
@@ -17,16 +17,16 @@ class StackedLSTMCell(nn.Module):
for
_
in
range
(
self
.
lstm_num_layers
)])
def
forward
(
self
,
inputs
,
hidden
):
prev_
c
,
prev_
h
=
hidden
next_
c
,
next_
h
=
[],
[]
prev_
h
,
prev_
c
=
hidden
next_
h
,
next_
c
=
[],
[]
for
i
,
m
in
enumerate
(
self
.
lstm_modules
):
curr_
c
,
curr_
h
=
m
(
inputs
,
(
prev_
c
[
i
],
prev_
h
[
i
]))
curr_
h
,
curr_
c
=
m
(
inputs
,
(
prev_
h
[
i
],
prev_
c
[
i
]))
next_c
.
append
(
curr_c
)
next_h
.
append
(
curr_h
)
# current implementation only supports batch size equals 1,
# but the algorithm does not necessarily have this limitation
inputs
=
curr_h
[
-
1
].
view
(
1
,
-
1
)
return
next_
c
,
next_
h
return
next_
h
,
next_
c
class
EnasMutator
(
Mutator
):
...
...
@@ -136,7 +136,7 @@ class EnasMutator(Mutator):
self
.
sample_skip_penalty
=
0
def
_lstm_next_step
(
self
):
self
.
_
c
,
self
.
_
h
=
self
.
lstm
(
self
.
_inputs
,
(
self
.
_
c
,
self
.
_
h
))
self
.
_
h
,
self
.
_
c
=
self
.
lstm
(
self
.
_inputs
,
(
self
.
_
h
,
self
.
_
c
))
def
_mark_anchor
(
self
,
key
):
self
.
_anchors_hid
[
key
]
=
self
.
_h
[
-
1
]
...
...
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