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
8c2c9b46
Commit
8c2c9b46
authored
May 21, 2019
by
Adam Rogowiec
Committed by
arogowie-intel
May 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add node validation.
parent
10649e87
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
lstm_cell.cpp
src/ngraph/op/fused/lstm_cell.cpp
+62
-0
No files found.
src/ngraph/op/fused/lstm_cell.cpp
View file @
8c2c9b46
...
...
@@ -170,6 +170,14 @@ op::LSTMCell::LSTMCell(const shared_ptr<Node>& X,
// 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
);
}
...
...
@@ -183,12 +191,66 @@ op::LSTMCell::LSTMCell(const shared_ptr<Node>& X,
vector
<
float
>
(
m_peepholes_count
*
get_hidden_size
(),
0.
f
));
}
NODE_VALIDATION_CHECK
(
this
,
(
P
->
get_shape
()
==
Shape
{
3
*
get_hidden_size
()}),
"Input tensor P must have shape ("
,
3
*
get_hidden_size
(),
"). Actual shape is:"
,
P
->
get_shape
(),
"."
);
m_p_iof
=
builder
::
split
(
peephole_weights
,
m_peepholes_count
);
constructor_validate_and_infer_types
();
}
void
op
::
LSTMCell
::
pre_validate_and_infer_types
()
{
const
auto
&
x_shape
=
input
(
0
).
get_shape
();
const
size_t
batch_size
=
x_shape
.
at
(
0
);
const
size_t
input_size
=
x_shape
.
at
(
1
);
const
auto
&
w_shape
=
input
(
1
).
get_shape
();
const
auto
&
r_shape
=
input
(
2
).
get_shape
();
const
auto
&
ht_shape
=
input
(
3
).
get_shape
();
const
auto
&
ct_shape
=
input
(
4
).
get_shape
();
NODE_VALIDATION_CHECK
(
this
,
(
w_shape
==
Shape
{
4
*
get_hidden_size
(),
input_size
}),
"Input tensor W must have shape ("
,
4
*
get_hidden_size
(),
", "
,
input_size
,
"). Actual shape is:"
,
w_shape
,
"."
);
NODE_VALIDATION_CHECK
(
this
,
(
r_shape
==
Shape
{
4
*
get_hidden_size
(),
get_hidden_size
()}),
"Input tensor R must have shape ("
,
4
*
get_hidden_size
(),
", "
,
get_hidden_size
(),
"). Actual shape is:"
,
w_shape
,
"."
);
NODE_VALIDATION_CHECK
(
this
,
(
ht_shape
==
Shape
{
batch_size
,
get_hidden_size
()}),
"Input tensor H_t must have shape ("
,
batch_size
,
", "
,
get_hidden_size
(),
"). Actual shape is:"
,
w_shape
,
"."
);
NODE_VALIDATION_CHECK
(
this
,
(
ct_shape
==
Shape
{
batch_size
,
get_hidden_size
()}),
"Input tensor C_t must have shape ("
,
batch_size
,
", "
,
get_hidden_size
(),
"). Actual shape is:"
,
w_shape
,
"."
);
}
NodeVector
op
::
LSTMCell
::
decompose_op
()
const
...
...
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