Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Franck Dary
macaon
Commits
5e1f4062
Commit
5e1f4062
authored
Mar 30, 2021
by
Franck Dary
Browse files
Fixed 'outputAll' option for LSTM module
parent
1473579c
Changes
2
Hide whitespace changes
Inline
Side-by-side
torch_modules/src/ContextualModule.cpp
View file @
5e1f4062
...
...
@@ -29,7 +29,7 @@ ContextualModuleImpl::ContextualModuleImpl(std::string name, const std::string &
.
bidirectional
(
std
::
stoi
(
subModuleArguments
[
0
]))
.
num_layers
(
std
::
stoi
(
subModuleArguments
[
1
]))
.
dropout
(
std
::
stof
(
subModuleArguments
[
2
]))
.
complete
(
std
::
stoi
(
subModuleArguments
[
3
])
);
.
complete
(
true
);
for
(
auto
&
target
:
util
::
split
(
sm
.
str
(
8
),
' '
))
{
...
...
torch_modules/src/LSTM.cpp
View file @
5e1f4062
...
...
@@ -13,7 +13,12 @@ LSTMImpl::LSTMImpl(int inputSize, int outputSize, ModuleOptions options) : outpu
torch
::
Tensor
LSTMImpl
::
forward
(
torch
::
Tensor
input
)
{
return
std
::
get
<
0
>
(
lstm
(
input
));
auto
res
=
std
::
get
<
0
>
(
lstm
(
input
));
if
(
outputAll
)
return
res
;
return
torch
::
cat
({
torch
::
narrow
(
res
,
1
,
0
,
1
),
torch
::
narrow
(
res
,
1
,
res
.
size
(
1
)
-
1
,
1
)},
1
);
}
int
LSTMImpl
::
getOutputSize
(
int
sequenceLength
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment