Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
b5f14735
Commit
b5f14735
authored
May 22, 2019
by
Adam Rogowiec
Committed by
arogowie-intel
May 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disambiguate constructors.
parent
8c2c9b46
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
36 deletions
+15
-36
lstm_cell.cpp
src/ngraph/op/fused/lstm_cell.cpp
+13
-34
lstm_cell.hpp
src/ngraph/op/fused/lstm_cell.hpp
+2
-2
No files found.
src/ngraph/op/fused/lstm_cell.cpp
View file @
b5f14735
...
...
@@ -158,48 +158,27 @@ op::LSTMCell::LSTMCell(const shared_ptr<Node>& X,
,
m_activation_h
{
get_activation_function
(
2
)}
,
m_input_forget
{
input_forget
}
{
// Normally we would split B onto Wb an Rb and add them, however here they are all zeros,
// thus just initialize bias with appropriate shape and zeros.
if
(
!
B
)
{
m_bias
=
ngraph
::
op
::
Constant
::
create
(
element
::
f32
,
Shape
{
m_gates_count
*
get_hidden_size
()},
vector
<
float
>
(
m_gates_count
*
get_hidden_size
(),
0.
f
));
}
// Split B onto Wb an Rb and add them.
else
{
NODE_VALIDATION_CHECK
(
this
,
(
B
->
get_shape
()
==
Shape
{
2
*
m_gates_count
*
get_hidden_size
()}),
"Input tensor B must have shape ("
,
8
*
get_hidden_size
(),
"). Actual shape is:"
,
B
->
get_shape
(),
"."
);
NodeVector
b_W_R
=
builder
::
split
(
B
,
2
);
m_bias
=
b_W_R
.
at
(
0
)
+
b_W_R
.
at
(
1
);
}
// Split B onto Wb and Rb and add them.
NODE_VALIDATION_CHECK
(
this
,
(
B
->
get_shape
()
==
Shape
{
2
*
m_gates_count
*
get_hidden_size
()}),
"Input tensor B must have shape ("
,
8
*
get_hidden_size
(),
"). Actual shape is:"
,
B
->
get_shape
(),
"."
);
auto
peephole_weights
=
P
;
if
(
!
peephole_weights
)
{
peephole_weights
=
ngraph
::
op
::
Constant
::
create
(
element
::
f32
,
Shape
{
m_peepholes_count
*
get_hidden_size
()},
vector
<
float
>
(
m_peepholes_count
*
get_hidden_size
(),
0.
f
));
}
NodeVector
b_W_R
=
builder
::
split
(
B
,
2
);
m_bias
=
b_W_R
.
at
(
0
)
+
b_W_R
.
at
(
1
);
NODE_VALIDATION_CHECK
(
this
,
(
P
->
get_shape
()
==
Shape
{
3
*
get_hidden_size
()}),
(
P
->
get_shape
()
==
Shape
{
m_peepholes_count
*
get_hidden_size
()}),
"Input tensor P must have shape ("
,
3
*
get_hidden_size
(),
m_peepholes_count
*
get_hidden_size
(),
"). Actual shape is:"
,
P
->
get_shape
(),
"."
);
m_p_iof
=
builder
::
split
(
peephole_weights
,
m_peepholes_count
);
m_p_iof
=
builder
::
split
(
P
,
m_peepholes_count
);
constructor_validate_and_infer_types
();
}
...
...
src/ngraph/op/fused/lstm_cell.hpp
View file @
b5f14735
...
...
@@ -127,8 +127,8 @@ namespace ngraph
const
std
::
shared_ptr
<
Node
>&
H_t
,
const
std
::
shared_ptr
<
Node
>&
C_t
,
std
::
size_t
hidden_size
,
const
std
::
shared_ptr
<
Node
>&
B
=
nullptr
,
const
std
::
shared_ptr
<
Node
>&
P
=
nullptr
,
const
std
::
shared_ptr
<
Node
>&
B
,
const
std
::
shared_ptr
<
Node
>&
P
,
const
std
::
vector
<
std
::
string
>&
activations
=
std
::
vector
<
std
::
string
>
{
"sigmoid"
,
"tanh"
,
"tanh"
},
const
std
::
vector
<
float
>&
activation_alpha
=
{},
...
...
Write
Preview
Markdown
is supported
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