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
5318dd46
Unverified
Commit
5318dd46
authored
Sep 07, 2020
by
Yuge Zhang
Committed by
GitHub
Sep 07, 2020
Browse files
Merge pull request #2842 from jyh2986/master
fix wrong order of hidden and cell state
parents
e51aca42
23b892ca
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 @
5318dd46
...
@@ -17,16 +17,16 @@ class StackedLSTMCell(nn.Module):
...
@@ -17,16 +17,16 @@ class StackedLSTMCell(nn.Module):
for
_
in
range
(
self
.
lstm_num_layers
)])
for
_
in
range
(
self
.
lstm_num_layers
)])
def
forward
(
self
,
inputs
,
hidden
):
def
forward
(
self
,
inputs
,
hidden
):
prev_
c
,
prev_
h
=
hidden
prev_
h
,
prev_
c
=
hidden
next_
c
,
next_
h
=
[],
[]
next_
h
,
next_
c
=
[],
[]
for
i
,
m
in
enumerate
(
self
.
lstm_modules
):
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_c
.
append
(
curr_c
)
next_h
.
append
(
curr_h
)
next_h
.
append
(
curr_h
)
# current implementation only supports batch size equals 1,
# current implementation only supports batch size equals 1,
# but the algorithm does not necessarily have this limitation
# but the algorithm does not necessarily have this limitation
inputs
=
curr_h
[
-
1
].
view
(
1
,
-
1
)
inputs
=
curr_h
[
-
1
].
view
(
1
,
-
1
)
return
next_
c
,
next_
h
return
next_
h
,
next_
c
class
EnasMutator
(
Mutator
):
class
EnasMutator
(
Mutator
):
...
@@ -136,7 +136,7 @@ class EnasMutator(Mutator):
...
@@ -136,7 +136,7 @@ class EnasMutator(Mutator):
self
.
sample_skip_penalty
=
0
self
.
sample_skip_penalty
=
0
def
_lstm_next_step
(
self
):
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
):
def
_mark_anchor
(
self
,
key
):
self
.
_anchors_hid
[
key
]
=
self
.
_h
[
-
1
]
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