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
93255d43
Commit
93255d43
authored
May 24, 2019
by
Adam Rogowiec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove static qualifier for clip function.
parent
ad30a5bd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
14 deletions
+12
-14
lstm_cell.cpp
src/ngraph/op/fused/lstm_cell.cpp
+5
-5
rnn_cell.cpp
src/ngraph/op/fused/rnn_cell.cpp
+1
-1
rnn_cell_base.cpp
src/ngraph/op/fused/rnn_cell_base.cpp
+4
-4
rnn_cell_base.hpp
src/ngraph/op/fused/rnn_cell_base.hpp
+2
-4
No files found.
src/ngraph/op/fused/lstm_cell.cpp
View file @
93255d43
...
...
@@ -242,7 +242,7 @@ NodeVector op::LSTMCell::decompose_op() const
auto
c_t
=
split_gates
.
at
(
3
);
// f(Xt*(Wi^T) + Ht-1*(Ri^T) + Pi (.) Ct-1 + Wbi + Rbi)
i_t
=
m_activation_f
(
clip
(
add
(
i_t
,
mul
(
p_i
,
m_C_t
))
,
get_clip
()
));
i_t
=
m_activation_f
(
clip
(
add
(
i_t
,
mul
(
p_i
,
m_C_t
))));
if
(
m_input_forget
)
{
// Couple input with forget gate: 1 - i_t
...
...
@@ -255,14 +255,14 @@ NodeVector op::LSTMCell::decompose_op() const
else
{
// f(Xt*(Wf^T) + Ht-1*(Rf^T) + Pf (.) Ct-1 + Wbf + Rbf)
f_t
=
m_activation_f
(
clip
(
add
(
f_t
,
mul
(
p_f
,
m_C_t
))
,
get_clip
()
));
f_t
=
m_activation_f
(
clip
(
add
(
f_t
,
mul
(
p_f
,
m_C_t
))));
}
// ft (.) Ct-1 + it (.) ct
auto
C
=
add
(
mul
(
f_t
,
m_C_t
),
mul
(
i_t
,
m_activation_g
(
clip
(
c_t
,
get_clip
()
))));
auto
C
=
add
(
mul
(
f_t
,
m_C_t
),
mul
(
i_t
,
m_activation_g
(
clip
(
c_t
))));
// f(Xt*(Wo^T) + Ht-1*(Ro^T) + Po (.) Ct + Wbo + Rbo)
o_t
=
m_activation_f
(
clip
(
add
(
o_t
,
mul
(
p_o
,
C
))
,
get_clip
()
));
o_t
=
m_activation_f
(
clip
(
add
(
o_t
,
mul
(
p_o
,
C
))));
// ot (.) h(Ct)
auto
H
=
mul
(
o_t
,
m_activation_h
(
clip
(
C
,
get_clip
()
)));
auto
H
=
mul
(
o_t
,
m_activation_h
(
clip
(
C
)));
return
{
H
,
C
};
}
...
...
src/ngraph/op/fused/rnn_cell.cpp
View file @
93255d43
...
...
@@ -182,7 +182,7 @@ NodeVector op::RNNCell::decompose_op() const
auto
i_t
=
add
(
Xt_W
,
add
(
Ht_R
,
m_bias
));
// f(Xt*(Wi^T) + Ht-1*(Ri^T) + Wbi + Rbi)
i_t
=
m_activation_f
(
clip
(
i_t
,
get_clip
()
));
i_t
=
m_activation_f
(
clip
(
i_t
));
return
{
i_t
};
}
...
...
src/ngraph/op/fused/rnn_cell_base.cpp
View file @
93255d43
...
...
@@ -86,15 +86,15 @@ shared_ptr<Node> op::RNNCellBase::mul(const shared_ptr<Node>& lhs, const shared_
return
{
make_shared
<
op
::
Multiply
>
(
args
.
at
(
0
),
args
.
at
(
1
))};
}
shared_ptr
<
Node
>
op
::
RNNCellBase
::
clip
(
const
shared_ptr
<
Node
>&
data
,
const
float
threshold
)
shared_ptr
<
Node
>
op
::
RNNCellBase
::
clip
(
const
shared_ptr
<
Node
>&
data
)
const
{
if
(
threshold
==
0.
f
)
if
(
m_clip
==
0.
f
)
{
return
data
;
}
float
min_val
=
-
threshold
;
float
max_val
=
threshold
;
float
min_val
=
-
m_clip
;
float
max_val
=
m_clip
;
size_t
size
=
shape_size
(
data
->
get_shape
());
const
shared_ptr
<
Node
>
min_val_node
=
op
::
Constant
::
create
(
data
->
get_element_type
(),
data
->
get_shape
(),
vector
<
float
>
(
size
,
min_val
));
...
...
src/ngraph/op/fused/rnn_cell_base.hpp
View file @
93255d43
...
...
@@ -101,13 +101,11 @@ namespace ngraph
///
/// \brief Creates node with element-wise clip operation with numpy broadcasting.
///
/// \param[in] lhs The left hand side argument node.
/// \param[in] rhs The right hand side argument node.
/// \param[in] data The input tensor for clipping.
///
/// \return Node with element-wise clip operation.
///
static
std
::
shared_ptr
<
Node
>
clip
(
const
std
::
shared_ptr
<
Node
>&
data
,
const
float
threshold
);
std
::
shared_ptr
<
Node
>
clip
(
const
std
::
shared_ptr
<
Node
>&
data
)
const
;
private
:
std
::
size_t
m_hidden_size
=
0.
f
;
...
...
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