Skip to content

Commit

Permalink
enable CPU kernel for all RNN layer forward (apache#11807)
Browse files Browse the repository at this point in the history
  • Loading branch information
szha authored and KellenSunderland committed Jul 21, 2018
1 parent 3b847e5 commit 2eebed9
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions python/mxnet/gluon/rnn/rnn_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,7 @@ def forward(self, inputs, states=None):
for i in range(self._dir):
self.i2h_weight[i].shape = (self._gates*self._hidden_size, inputs.shape[2])
self.i2h_weight[i]._finish_deferred_init()
if inputs.context.device_type == 'gpu' or \
self._mode in ['lstm', 'gru'] and not self._dropout:
out = self._forward_kernel(inputs, states)
else:
out = self._forward(inputs, states)
out = self._forward_kernel(inputs, states)

# out is (output, state)
return out[0] if skip_states else out
Expand Down

0 comments on commit 2eebed9

Please sign in to comment.