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

Commit

Permalink
[MXNET-969] Use ternary op for statecell
Browse files Browse the repository at this point in the history
  • Loading branch information
KellenSunderland committed Sep 20, 2018
1 parent 7e91550 commit 9750480
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/operator/rnn-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -553,12 +553,6 @@ class RNNOp : public Operator{

DType* reserve_space_ptr = static_cast<DType*>(reserve_space_.dptr);

int req_statecell = 0;
if (param_.mode == rnn_enum::kLstm) {
// State cell should be present for LSTMs.
req_statecell = req[rnn_enum::kStateCell];
}

RNNBackward<DType>(workspace.dptr_,
reserve_space_ptr,
param_.num_layers,
Expand All @@ -583,7 +577,8 @@ class RNNOp : public Operator{
req[rnn_enum::kData],
req[rnn_enum::kParams],
req[rnn_enum::kState],
req_statecell,
// State cell should be present for LSTMs, but is absent for other RNNs.
param_.mode == rnn_enum::kLstm ? req[rnn_enum::kStateCell] : kNullOp,
param_.p,
param_.mode);
}
Expand Down

0 comments on commit 9750480

Please sign in to comment.