Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
set __layout__ attribute for FusedRNNCell output states (#6747)
Browse files Browse the repository at this point in the history
* set __layout__ attr for FucedRNNCell output states

* right usage not that in desc
  • Loading branch information
formath authored and piiswrong committed Jun 20, 2017
1 parent 63ac793 commit 94d8e18
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/mxnet/rnn/rnn_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,11 +672,15 @@ def unroll(self, length, inputs, begin_state=None, layout='NTC', merge_outputs=N
mode=self._mode, name=self._prefix+'rnn',
**states)

attr = {'__layout__' : 'LNC'}
if not self._get_next_state:
outputs, states = rnn, []
elif self._mode == 'lstm':
rnn[1]._set_attr(**attr)
rnn[2]._set_attr(**attr)
outputs, states = rnn[0], [rnn[1], rnn[2]]
else:
rnn[1]._set_attr(**attr)
outputs, states = rnn[0], [rnn[1]]

if axis == 1:
Expand Down

0 comments on commit 94d8e18

Please sign in to comment.