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

set __layout__ attribute for FusedRNNCell output states #6747

Merged
merged 2 commits into from
Jun 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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