Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
f1bce841
Commit
f1bce841
authored
Jan 30, 2019
by
Shucai Xiao
Browse files
clang format.
parent
09336f53
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
77 deletions
+105
-77
test/gpu/miopen.cpp
test/gpu/miopen.cpp
+47
-44
test/op_shape_test.cpp
test/op_shape_test.cpp
+58
-33
No files found.
test/gpu/miopen.cpp
View file @
f1bce841
...
...
@@ -1058,7 +1058,7 @@ struct test_rnn_forward
std
::
size_t
hidden_size
=
4
;
std
::
size_t
input_size
=
3
;
std
::
size_t
num_dirct
=
1
;
float
clip
=
0.0
f
;
float
clip
=
0.0
f
;
migraphx
::
program
p
;
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
...
...
@@ -1067,21 +1067,22 @@ struct test_rnn_forward
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
hidden_size
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
2
*
hidden_size
}};
auto
seq
=
p
.
add_parameter
(
"seq"
,
in_shape
);
auto
ih
=
p
.
add_parameter
(
"ih"
,
ih_shape
);
auto
w
=
p
.
add_parameter
(
"w"
,
w_shape
);
auto
r
=
p
.
add_parameter
(
"r"
,
r_shape
);
auto
seq
=
p
.
add_parameter
(
"seq"
,
in_shape
);
auto
ih
=
p
.
add_parameter
(
"ih"
,
ih_shape
);
auto
w
=
p
.
add_parameter
(
"w"
,
w_shape
);
auto
r
=
p
.
add_parameter
(
"r"
,
r_shape
);
auto
bias
=
p
.
add_parameter
(
"bias"
,
b_shape
);
auto
output
=
p
.
add_instruction
(
migraphx
::
op
::
rnn
{
hidden_size
,
{
migraphx
::
op
::
tanh
{},
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
forward
,
clip
},
seq
,
w
,
r
,
bias
,
ih
);
auto
output
=
p
.
add_instruction
(
migraphx
::
op
::
rnn
{
hidden_size
,
{
migraphx
::
op
::
tanh
{},
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
forward
,
clip
},
seq
,
w
,
r
,
bias
,
ih
);
auto
last
=
p
.
add_instruction
(
migraphx
::
op
::
rnn_last_output
{},
output
);
p
.
add_instruction
(
migraphx
::
op
::
add
{},
last
,
last
);
...
...
@@ -1098,7 +1099,7 @@ struct test_rnn_reverse
std
::
size_t
hidden_size
=
4
;
std
::
size_t
input_size
=
3
;
std
::
size_t
num_dirct
=
1
;
float
clip
=
0.0
f
;
float
clip
=
0.0
f
;
migraphx
::
program
p
;
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
...
...
@@ -1107,24 +1108,25 @@ struct test_rnn_reverse
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
hidden_size
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
2
*
hidden_size
}};
auto
seq
=
p
.
add_parameter
(
"seq"
,
in_shape
);
auto
ih
=
p
.
add_parameter
(
"ih"
,
ih_shape
);
auto
w
=
p
.
add_parameter
(
"w"
,
w_shape
);
auto
r
=
p
.
add_parameter
(
"r"
,
r_shape
);
auto
seq
=
p
.
add_parameter
(
"seq"
,
in_shape
);
auto
ih
=
p
.
add_parameter
(
"ih"
,
ih_shape
);
auto
w
=
p
.
add_parameter
(
"w"
,
w_shape
);
auto
r
=
p
.
add_parameter
(
"r"
,
r_shape
);
auto
bias
=
p
.
add_parameter
(
"bias"
,
b_shape
);
auto
output
=
p
.
add_instruction
(
migraphx
::
op
::
rnn
{
hidden_size
,
{
migraphx
::
op
::
tanh
{},
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
reverse
,
clip
},
seq
,
w
,
r
,
bias
,
ih
);
auto
output
=
p
.
add_instruction
(
migraphx
::
op
::
rnn
{
hidden_size
,
{
migraphx
::
op
::
tanh
{},
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
reverse
,
clip
},
seq
,
w
,
r
,
bias
,
ih
);
auto
last
=
p
.
add_instruction
(
migraphx
::
op
::
rnn_last_output
{},
output
);
p
.
add_instruction
(
migraphx
::
op
::
add
{},
last
,
last
);
return
p
;
}
};
...
...
@@ -1138,7 +1140,7 @@ struct test_rnn_bidirectional
std
::
size_t
hidden_size
=
4
;
std
::
size_t
input_size
=
3
;
std
::
size_t
num_dirct
=
2
;
float
clip
=
0.0
f
;
float
clip
=
0.0
f
;
migraphx
::
program
p
;
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
...
...
@@ -1147,24 +1149,25 @@ struct test_rnn_bidirectional
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
hidden_size
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
2
*
hidden_size
}};
auto
seq
=
p
.
add_parameter
(
"seq"
,
in_shape
);
auto
ih
=
p
.
add_parameter
(
"ih"
,
ih_shape
);
auto
w
=
p
.
add_parameter
(
"w"
,
w_shape
);
auto
r
=
p
.
add_parameter
(
"r"
,
r_shape
);
auto
seq
=
p
.
add_parameter
(
"seq"
,
in_shape
);
auto
ih
=
p
.
add_parameter
(
"ih"
,
ih_shape
);
auto
w
=
p
.
add_parameter
(
"w"
,
w_shape
);
auto
r
=
p
.
add_parameter
(
"r"
,
r_shape
);
auto
bias
=
p
.
add_parameter
(
"bias"
,
b_shape
);
auto
output
=
p
.
add_instruction
(
migraphx
::
op
::
rnn
{
hidden_size
,
{
migraphx
::
op
::
tanh
{},
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
bidirectional
,
clip
},
seq
,
w
,
r
,
bias
,
ih
);
auto
output
=
p
.
add_instruction
(
migraphx
::
op
::
rnn
{
hidden_size
,
{
migraphx
::
op
::
tanh
{},
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
bidirectional
,
clip
},
seq
,
w
,
r
,
bias
,
ih
);
auto
last
=
p
.
add_instruction
(
migraphx
::
op
::
rnn_last_output
{},
output
);
p
.
add_instruction
(
migraphx
::
op
::
add
{},
last
,
last
);
return
p
;
}
};
...
...
test/op_shape_test.cpp
View file @
f1bce841
...
...
@@ -257,7 +257,7 @@ TEST_CASE(rnn)
std
::
size_t
hidden_size
=
4
;
std
::
size_t
input_size
=
3
;
std
::
size_t
num_dirct
=
1
;
float
clip
=
0.0
f
;
float
clip
=
0.0
f
;
migraphx
::
program
p
;
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
...
...
@@ -266,11 +266,15 @@ TEST_CASE(rnn)
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
hidden_size
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
2
*
hidden_size
}};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
num_dirct
,
batch_size
,
hidden_size
}},
migraphx
::
op
::
rnn
{
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
forward
,
clip
},
in_shape
,
w_shape
,
r_shape
,
b_shape
,
ih_shape
);
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
num_dirct
,
batch_size
,
hidden_size
}},
migraphx
::
op
::
rnn
{
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
forward
,
clip
},
in_shape
,
w_shape
,
r_shape
,
b_shape
,
ih_shape
);
}
{
...
...
@@ -279,7 +283,7 @@ TEST_CASE(rnn)
std
::
size_t
hidden_size
=
4
;
std
::
size_t
input_size
=
3
;
std
::
size_t
num_dirct
=
1
;
float
clip
=
0.0
f
;
float
clip
=
0.0
f
;
migraphx
::
program
p
;
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
...
...
@@ -288,11 +292,15 @@ TEST_CASE(rnn)
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
hidden_size
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
2
*
hidden_size
}};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
num_dirct
,
batch_size
,
hidden_size
}},
migraphx
::
op
::
rnn
{
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
reverse
,
clip
},
in_shape
,
w_shape
,
r_shape
,
b_shape
,
ih_shape
);
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
num_dirct
,
batch_size
,
hidden_size
}},
migraphx
::
op
::
rnn
{
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
reverse
,
clip
},
in_shape
,
w_shape
,
r_shape
,
b_shape
,
ih_shape
);
}
{
...
...
@@ -301,7 +309,7 @@ TEST_CASE(rnn)
std
::
size_t
hidden_size
=
4
;
std
::
size_t
input_size
=
3
;
std
::
size_t
num_dirct
=
2
;
float
clip
=
0.0
f
;
float
clip
=
0.0
f
;
migraphx
::
program
p
;
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
...
...
@@ -310,11 +318,16 @@ TEST_CASE(rnn)
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
hidden_size
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
2
*
hidden_size
}};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
num_dirct
,
batch_size
,
hidden_size
}},
migraphx
::
op
::
rnn
{
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
bidirectional
,
clip
},
in_shape
,
w_shape
,
r_shape
,
b_shape
,
ih_shape
);
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
num_dirct
,
batch_size
,
hidden_size
}},
migraphx
::
op
::
rnn
{
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
bidirectional
,
clip
},
in_shape
,
w_shape
,
r_shape
,
b_shape
,
ih_shape
);
}
{
...
...
@@ -323,7 +336,7 @@ TEST_CASE(rnn)
std
::
size_t
hidden_size
=
4
;
std
::
size_t
input_size
=
3
;
std
::
size_t
num_dirct
=
1
;
float
clip
=
0.0
f
;
float
clip
=
0.0
f
;
migraphx
::
program
p
;
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
...
...
@@ -332,10 +345,14 @@ TEST_CASE(rnn)
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
hidden_size
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
2
*
hidden_size
}};
throws_shape
(
migraphx
::
op
::
rnn
{
hidden_size
+
1
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
forward
,
clip
},
in_shape
,
w_shape
,
r_shape
,
b_shape
,
ih_shape
);
throws_shape
(
migraphx
::
op
::
rnn
{
hidden_size
+
1
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
forward
,
clip
},
in_shape
,
w_shape
,
r_shape
,
b_shape
,
ih_shape
);
}
{
...
...
@@ -344,7 +361,7 @@ TEST_CASE(rnn)
std
::
size_t
hidden_size
=
4
;
std
::
size_t
input_size
=
3
;
std
::
size_t
num_dirct
=
1
;
float
clip
=
0.0
f
;
float
clip
=
0.0
f
;
migraphx
::
program
p
;
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
...
...
@@ -353,10 +370,14 @@ TEST_CASE(rnn)
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
hidden_size
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
2
*
hidden_size
}};
throws_shape
(
migraphx
::
op
::
rnn
{
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
bidirectional
,
clip
},
in_shape
,
w_shape
,
r_shape
,
b_shape
,
ih_shape
);
throws_shape
(
migraphx
::
op
::
rnn
{
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
bidirectional
,
clip
},
in_shape
,
w_shape
,
r_shape
,
b_shape
,
ih_shape
);
}
{
...
...
@@ -365,7 +386,7 @@ TEST_CASE(rnn)
std
::
size_t
hidden_size
=
4
;
std
::
size_t
input_size
=
3
;
std
::
size_t
num_dirct
=
2
;
float
clip
=
0.0
f
;
float
clip
=
0.0
f
;
migraphx
::
program
p
;
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
...
...
@@ -374,10 +395,14 @@ TEST_CASE(rnn)
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
hidden_size
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
2
*
hidden_size
}};
throws_shape
(
migraphx
::
op
::
rnn
{
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
forward
,
clip
},
in_shape
,
w_shape
,
r_shape
,
b_shape
,
ih_shape
);
throws_shape
(
migraphx
::
op
::
rnn
{
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
forward
,
clip
},
in_shape
,
w_shape
,
r_shape
,
b_shape
,
ih_shape
);
}
}
...
...
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