Repository navigation
dnn: Allow LSTM layer to operate in reverse direction - #15580
Merged
Merged
Conversation
Member
|
@smbz, thanks for contribution! Please change the target branch to 3.4 (we will cherry pick this commit to master after that). |
smbz
force-pushed
the
dnn-lstm-reverse
branch
from
September 25, 2019 12:25
a457aa9 to
bfbddf8
Compare
Contributor
Author
|
You're welcome! Changed to 3.4 and squashed to a single commit (now that I've read the contribution guidelines properly :P ) |
alalek
reviewed
Sep 25, 2019
| LayerParams lp; | ||
| lp.set("reverse", true); | ||
| lp.set("use_timestamp_dim", true); | ||
| lp.blobs = std::vector<cv::Mat>{ Wh, Wx, bias }; |
Member
There was a problem hiding this comment.
OpenCV 3.4 code should be C++98 compatible.
lp.blobs.push_back(Wh);
lp.blobs.push_back(Wx);
lp.blobs.push_back(bias);
smbz
force-pushed
the
dnn-lstm-reverse
branch
from
September 25, 2019 13:07
bfbddf8 to
085e246
Compare
Contributor
Author
|
I've just replaced the initializer lists and "auto"; I think everything else is C++98 compatible. |
This is useful for bidirectional LSTMs.
smbz
force-pushed
the
dnn-lstm-reverse
branch
from
September 25, 2019 13:13
085e246 to
b88435f
Compare
opencv-pushbot
pushed a commit
that referenced
this pull request
Sep 25, 2019
Merged
SavyaSanchi-Sharma
pushed a commit
to SavyaSanchi-Sharma/opencv
that referenced
this pull request
Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This can be used to produce a bidirectional LSTM by having two operating in parallel on the same input, but operating in different directions.
This pullrequest changes
This PR lets cv::dnn::LSTMLayer interpret a new boolean parameter in the LayerParams called "reverse". If it is true, the LSTM operates in the reverse direction to normal.