Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
48c72797
Commit
48c72797
authored
Feb 20, 2019
by
Shucai Xiao
Browse files
clang format
parent
55453fe1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
59 deletions
+61
-59
test/cpu_rnn_ops_test.cpp
test/cpu_rnn_ops_test.cpp
+61
-59
No files found.
test/cpu_rnn_ops_test.cpp
View file @
48c72797
...
@@ -3158,7 +3158,8 @@ TEST_CASE(lstm_bidirectional_actv_func)
...
@@ -3158,7 +3158,8 @@ TEST_CASE(lstm_bidirectional_actv_func)
auto
seq
=
p
.
add_literal
(
migraphx
::
literal
{
in_shape
,
input_data
});
auto
seq
=
p
.
add_literal
(
migraphx
::
literal
{
in_shape
,
input_data
});
auto
w
=
p
.
add_literal
(
migraphx
::
literal
{
w_shape
,
w_data
});
auto
w
=
p
.
add_literal
(
migraphx
::
literal
{
w_shape
,
w_data
});
auto
r
=
p
.
add_literal
(
migraphx
::
literal
{
r_shape
,
r_data
});
auto
r
=
p
.
add_literal
(
migraphx
::
literal
{
r_shape
,
r_data
});
auto
hs
=
p
.
add_instruction
(
migraphx
::
op
::
lstm
{
hidden_size
,
auto
hs
=
p
.
add_instruction
(
migraphx
::
op
::
lstm
{
hidden_size
,
{
migraphx
::
op
::
sigmoid
{},
migraphx
::
op
::
tanh
{}},
{
migraphx
::
op
::
sigmoid
{},
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn_direction
::
bidirectional
,
migraphx
::
op
::
rnn_direction
::
bidirectional
,
clip
,
clip
,
...
@@ -3172,12 +3173,10 @@ TEST_CASE(lstm_bidirectional_actv_func)
...
@@ -3172,12 +3173,10 @@ TEST_CASE(lstm_bidirectional_actv_func)
std
::
vector
<
float
>
output_data
;
std
::
vector
<
float
>
output_data
;
hs_concat
.
visit
([
&
](
auto
output
)
{
output_data
.
assign
(
output
.
begin
(),
output
.
end
());
});
hs_concat
.
visit
([
&
](
auto
output
)
{
output_data
.
assign
(
output
.
begin
(),
output
.
end
());
});
std
::
vector
<
float
>
output_data_gold
{
std
::
vector
<
float
>
output_data_gold
{
-
0.165194
,
-
0.0372928
,
0.273786
,
-
0.100877
,
-
0.165194
,
-
0.0372928
,
0.273786
,
-
0.100877
,
-
0.0458544
,
-
0.0401315
,
-
0.0458544
,
-
0.0401315
,
0.0737483
,
-
0.064505
,
0.0737483
,
-
0.064505
,
0.136898
,
0.00160891
,
-
0.184812
,
0.147774
,
0.136898
,
0.00160891
,
-
0.184812
,
0.147774
,
-
0.162851
,
-
0.102647
,
-
0.113827
,
-
0.142818
,
0.0513685
,
0.0547876
,
-
0.162851
,
-
0.102647
,
-
0.113827
,
-
0.142818
,
0.0201981
,
-
0.00808453
,
-
0.00520328
,
0.0945081
,
0.264123
,
0.410805
};
0.0513685
,
0.0547876
,
0.0201981
,
-
0.00808453
,
-
0.00520328
,
0.0945081
,
0.264123
,
0.410805
};
EXPECT
(
migraphx
::
verify_range
(
output_data
,
output_data_gold
));
EXPECT
(
migraphx
::
verify_range
(
output_data
,
output_data_gold
));
}
}
...
@@ -3188,7 +3187,9 @@ TEST_CASE(lstm_bidirectional_actv_func)
...
@@ -3188,7 +3187,9 @@ TEST_CASE(lstm_bidirectional_actv_func)
auto
w
=
p
.
add_literal
(
migraphx
::
literal
{
w_shape
,
w_data
});
auto
w
=
p
.
add_literal
(
migraphx
::
literal
{
w_shape
,
w_data
});
auto
r
=
p
.
add_literal
(
migraphx
::
literal
{
r_shape
,
r_data
});
auto
r
=
p
.
add_literal
(
migraphx
::
literal
{
r_shape
,
r_data
});
auto
hs
=
p
.
add_instruction
(
migraphx
::
op
::
lstm
{
hidden_size
,
auto
hs
=
p
.
add_instruction
(
migraphx
::
op
::
lstm
{
hidden_size
,
{
migraphx
::
op
::
sigmoid
{},
migraphx
::
op
::
tanh
{},
migraphx
::
op
::
tanh
{},
{
migraphx
::
op
::
sigmoid
{},
migraphx
::
op
::
tanh
{},
migraphx
::
op
::
tanh
{},
migraphx
::
op
::
sigmoid
{}},
migraphx
::
op
::
sigmoid
{}},
migraphx
::
op
::
rnn_direction
::
bidirectional
,
migraphx
::
op
::
rnn_direction
::
bidirectional
,
clip
,
clip
,
...
@@ -3202,12 +3203,10 @@ TEST_CASE(lstm_bidirectional_actv_func)
...
@@ -3202,12 +3203,10 @@ TEST_CASE(lstm_bidirectional_actv_func)
std
::
vector
<
float
>
output_data
;
std
::
vector
<
float
>
output_data
;
hs_concat
.
visit
([
&
](
auto
output
)
{
output_data
.
assign
(
output
.
begin
(),
output
.
end
());
});
hs_concat
.
visit
([
&
](
auto
output
)
{
output_data
.
assign
(
output
.
begin
(),
output
.
end
());
});
std
::
vector
<
float
>
output_data_gold
{
std
::
vector
<
float
>
output_data_gold
{
-
0.165194
,
-
0.0372928
,
0.273786
,
-
0.100877
,
-
0.165194
,
-
0.0372928
,
0.273786
,
-
0.100877
,
-
0.0458544
,
-
0.0401315
,
-
0.0458544
,
-
0.0401315
,
0.0737483
,
-
0.064505
,
0.0737483
,
-
0.064505
,
0.136898
,
0.00160891
,
-
0.184812
,
0.147774
,
0.136898
,
0.00160891
,
-
0.184812
,
0.147774
,
0.246078
,
0.199709
,
0.303753
,
0.301178
,
0.264634
,
0.304661
,
0.246078
,
0.199709
,
0.303753
,
0.301178
,
0.349371
,
0.288934
,
0.405483
,
0.445586
,
0.515814
,
0.473186
};
0.264634
,
0.304661
,
0.349371
,
0.288934
,
0.405483
,
0.445586
,
0.515814
,
0.473186
};
EXPECT
(
migraphx
::
verify_range
(
output_data
,
output_data_gold
));
EXPECT
(
migraphx
::
verify_range
(
output_data
,
output_data_gold
));
}
}
...
@@ -3218,8 +3217,11 @@ TEST_CASE(lstm_bidirectional_actv_func)
...
@@ -3218,8 +3217,11 @@ TEST_CASE(lstm_bidirectional_actv_func)
auto
w
=
p
.
add_literal
(
migraphx
::
literal
{
w_shape
,
w_data
});
auto
w
=
p
.
add_literal
(
migraphx
::
literal
{
w_shape
,
w_data
});
auto
r
=
p
.
add_literal
(
migraphx
::
literal
{
r_shape
,
r_data
});
auto
r
=
p
.
add_literal
(
migraphx
::
literal
{
r_shape
,
r_data
});
auto
hs
=
p
.
add_instruction
(
migraphx
::
op
::
lstm
{
hidden_size
,
auto
hs
=
p
.
add_instruction
(
migraphx
::
op
::
lstm
{
hidden_size
,
{
migraphx
::
op
::
sigmoid
{},
migraphx
::
op
::
tanh
{},
migraphx
::
op
::
tanh
{},
{
migraphx
::
op
::
sigmoid
{},
migraphx
::
op
::
sigmoid
{},
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
tanh
{},
migraphx
::
op
::
tanh
{},
migraphx
::
op
::
sigmoid
{},
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn_direction
::
bidirectional
,
migraphx
::
op
::
rnn_direction
::
bidirectional
,
clip
,
clip
,
0
},
0
},
...
@@ -3232,12 +3234,10 @@ TEST_CASE(lstm_bidirectional_actv_func)
...
@@ -3232,12 +3234,10 @@ TEST_CASE(lstm_bidirectional_actv_func)
std
::
vector
<
float
>
output_data
;
std
::
vector
<
float
>
output_data
;
hs_concat
.
visit
([
&
](
auto
output
)
{
output_data
.
assign
(
output
.
begin
(),
output
.
end
());
});
hs_concat
.
visit
([
&
](
auto
output
)
{
output_data
.
assign
(
output
.
begin
(),
output
.
end
());
});
std
::
vector
<
float
>
output_data_gold
{
std
::
vector
<
float
>
output_data_gold
{
-
0.165194
,
-
0.0372928
,
0.273786
,
-
0.100877
,
-
0.165194
,
-
0.0372928
,
0.273786
,
-
0.100877
,
-
0.0458544
,
-
0.0401315
,
-
0.0458544
,
-
0.0401315
,
0.0737483
,
-
0.064505
,
0.0737483
,
-
0.064505
,
0.136898
,
0.00160891
,
-
0.184812
,
0.147774
,
0.136898
,
0.00160891
,
-
0.184812
,
0.147774
,
-
0.162851
,
-
0.102647
,
-
0.113827
,
-
0.142818
,
0.0513685
,
0.0547876
,
-
0.162851
,
-
0.102647
,
-
0.113827
,
-
0.142818
,
0.0201981
,
-
0.00808453
,
-
0.00520328
,
0.0945081
,
0.264123
,
0.410805
};
0.0513685
,
0.0547876
,
0.0201981
,
-
0.00808453
,
-
0.00520328
,
0.0945081
,
0.264123
,
0.410805
};
EXPECT
(
migraphx
::
verify_range
(
output_data
,
output_data_gold
));
EXPECT
(
migraphx
::
verify_range
(
output_data
,
output_data_gold
));
}
}
...
@@ -3248,8 +3248,12 @@ TEST_CASE(lstm_bidirectional_actv_func)
...
@@ -3248,8 +3248,12 @@ TEST_CASE(lstm_bidirectional_actv_func)
auto
w
=
p
.
add_literal
(
migraphx
::
literal
{
w_shape
,
w_data
});
auto
w
=
p
.
add_literal
(
migraphx
::
literal
{
w_shape
,
w_data
});
auto
r
=
p
.
add_literal
(
migraphx
::
literal
{
r_shape
,
r_data
});
auto
r
=
p
.
add_literal
(
migraphx
::
literal
{
r_shape
,
r_data
});
auto
hs
=
p
.
add_instruction
(
migraphx
::
op
::
lstm
{
hidden_size
,
auto
hs
=
p
.
add_instruction
(
migraphx
::
op
::
lstm
{
hidden_size
,
{
migraphx
::
op
::
sigmoid
{},
migraphx
::
op
::
tanh
{},
migraphx
::
op
::
tanh
{},
{
migraphx
::
op
::
sigmoid
{},
migraphx
::
op
::
sigmoid
{},
migraphx
::
op
::
tanh
{},
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
tanh
{},
migraphx
::
op
::
tanh
{},
migraphx
::
op
::
sigmoid
{},
migraphx
::
op
::
tanh
{},
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn_direction
::
bidirectional
,
migraphx
::
op
::
rnn_direction
::
bidirectional
,
clip
,
clip
,
0
},
0
},
...
@@ -3262,12 +3266,10 @@ TEST_CASE(lstm_bidirectional_actv_func)
...
@@ -3262,12 +3266,10 @@ TEST_CASE(lstm_bidirectional_actv_func)
std
::
vector
<
float
>
output_data
;
std
::
vector
<
float
>
output_data
;
hs_concat
.
visit
([
&
](
auto
output
)
{
output_data
.
assign
(
output
.
begin
(),
output
.
end
());
});
hs_concat
.
visit
([
&
](
auto
output
)
{
output_data
.
assign
(
output
.
begin
(),
output
.
end
());
});
std
::
vector
<
float
>
output_data_gold
{
std
::
vector
<
float
>
output_data_gold
{
-
0.165194
,
-
0.0372928
,
0.273786
,
-
0.100877
,
-
0.165194
,
-
0.0372928
,
0.273786
,
-
0.100877
,
-
0.0458544
,
-
0.0401315
,
-
0.0458544
,
-
0.0401315
,
0.0737483
,
-
0.064505
,
0.0737483
,
-
0.064505
,
0.136898
,
0.00160891
,
-
0.184812
,
0.147774
,
0.136898
,
0.00160891
,
-
0.184812
,
0.147774
,
-
0.162851
,
-
0.102647
,
-
0.113827
,
-
0.142818
,
0.0513685
,
0.0547876
,
-
0.162851
,
-
0.102647
,
-
0.113827
,
-
0.142818
,
0.0201981
,
-
0.00808453
,
-
0.00520328
,
0.0945081
,
0.264123
,
0.410805
};
0.0513685
,
0.0547876
,
0.0201981
,
-
0.00808453
,
-
0.00520328
,
0.0945081
,
0.264123
,
0.410805
};
EXPECT
(
migraphx
::
verify_range
(
output_data
,
output_data_gold
));
EXPECT
(
migraphx
::
verify_range
(
output_data
,
output_data_gold
));
}
}
}
}
...
...
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