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
6972ad26
Unverified
Commit
6972ad26
authored
Feb 09, 2019
by
Paul Fultz II
Committed by
GitHub
Feb 09, 2019
Browse files
Merge pull request #170 from ROCmSoftwarePlatform/gru_operator
Gru operator
parents
fb8fda8f
bce629f1
Changes
23
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
200 additions
and
33 deletions
+200
-33
test/onnx/rnn_rnn1layer.onnx
test/onnx/rnn_rnn1layer.onnx
+0
-0
test/onnx/rnn_rnnbi3layers.onnx
test/onnx/rnn_rnnbi3layers.onnx
+0
-0
test/op_shape_test.cpp
test/op_shape_test.cpp
+200
-33
No files found.
test/onnx/rnn_rnn1layer.onnx
deleted
100644 → 0
View file @
fb8fda8f
File deleted
test/onnx/rnn_rnnbi3layers.onnx
deleted
100644 → 0
View file @
fb8fda8f
File deleted
test/op_shape_test.cpp
View file @
6972ad26
...
@@ -276,17 +276,17 @@ TEST_CASE(rnn)
...
@@ -276,17 +276,17 @@ TEST_CASE(rnn)
std
::
size_t
num_dirct
=
1
;
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
}};
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
migraphx
::
shape
ih_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
batch_size
,
hidden_size
}};
migraphx
::
shape
ih_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
batch_size
,
hidden_size
}};
migraphx
::
shape
w_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
input_size
}};
migraphx
::
shape
w_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
input_size
}};
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
hidden_size
}};
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
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
2
*
hidden_size
}};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
num_dirct
,
batch_size
,
hidden_size
}},
{
seq_len
,
num_dirct
,
batch_size
,
hidden_size
}},
migraphx
::
op
::
rnn
{
migraphx
::
op
::
rnn
{
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
forward
,
clip
},
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
_direction
::
forward
,
clip
},
in_shape
,
in_shape
,
w_shape
,
w_shape
,
r_shape
,
r_shape
,
...
@@ -302,17 +302,17 @@ TEST_CASE(rnn)
...
@@ -302,17 +302,17 @@ TEST_CASE(rnn)
std
::
size_t
num_dirct
=
1
;
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
}};
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
migraphx
::
shape
ih_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
batch_size
,
hidden_size
}};
migraphx
::
shape
ih_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
batch_size
,
hidden_size
}};
migraphx
::
shape
w_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
input_size
}};
migraphx
::
shape
w_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
input_size
}};
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
hidden_size
}};
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
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
2
*
hidden_size
}};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
num_dirct
,
batch_size
,
hidden_size
}},
{
seq_len
,
num_dirct
,
batch_size
,
hidden_size
}},
migraphx
::
op
::
rnn
{
migraphx
::
op
::
rnn
{
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
reverse
,
clip
},
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
_direction
::
reverse
,
clip
},
in_shape
,
in_shape
,
w_shape
,
w_shape
,
r_shape
,
r_shape
,
...
@@ -328,18 +328,18 @@ TEST_CASE(rnn)
...
@@ -328,18 +328,18 @@ TEST_CASE(rnn)
std
::
size_t
num_dirct
=
2
;
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
}};
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
migraphx
::
shape
ih_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
batch_size
,
hidden_size
}};
migraphx
::
shape
ih_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
batch_size
,
hidden_size
}};
migraphx
::
shape
w_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
input_size
}};
migraphx
::
shape
w_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
input_size
}};
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
hidden_size
}};
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
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
2
*
hidden_size
}};
expect_shape
(
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
num_dirct
,
batch_size
,
hidden_size
}},
{
seq_len
,
num_dirct
,
batch_size
,
hidden_size
}},
migraphx
::
op
::
rnn
{
migraphx
::
op
::
rnn
{
hidden_size
,
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
bidirectional
,
clip
},
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn_direction
::
bidirectional
,
clip
},
in_shape
,
in_shape
,
w_shape
,
w_shape
,
r_shape
,
r_shape
,
...
@@ -355,16 +355,16 @@ TEST_CASE(rnn)
...
@@ -355,16 +355,16 @@ TEST_CASE(rnn)
std
::
size_t
num_dirct
=
1
;
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
}};
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
migraphx
::
shape
ih_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
batch_size
,
hidden_size
}};
migraphx
::
shape
ih_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
batch_size
,
hidden_size
}};
migraphx
::
shape
w_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
input_size
}};
migraphx
::
shape
w_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
input_size
}};
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
hidden_size
}};
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
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
2
*
hidden_size
}};
throws_shape
(
throws_shape
(
migraphx
::
op
::
rnn
{
hidden_size
+
1
,
migraphx
::
op
::
rnn
{
{
migraphx
::
op
::
tanh
{}},
hidden_size
+
1
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
forward
,
clip
},
migraphx
::
op
::
rnn_direction
::
forward
,
clip
},
in_shape
,
in_shape
,
w_shape
,
w_shape
,
r_shape
,
r_shape
,
...
@@ -380,16 +380,16 @@ TEST_CASE(rnn)
...
@@ -380,16 +380,16 @@ TEST_CASE(rnn)
std
::
size_t
num_dirct
=
1
;
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
}};
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
migraphx
::
shape
ih_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
batch_size
,
hidden_size
}};
migraphx
::
shape
ih_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
batch_size
,
hidden_size
}};
migraphx
::
shape
w_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
input_size
}};
migraphx
::
shape
w_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
input_size
}};
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
hidden_size
}};
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
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
2
*
hidden_size
}};
throws_shape
(
throws_shape
(
migraphx
::
op
::
rnn
{
hidden_size
,
migraphx
::
op
::
rnn
{
{
migraphx
::
op
::
tanh
{}},
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
bidirectional
,
clip
},
migraphx
::
op
::
rnn_direction
::
bidirectional
,
clip
},
in_shape
,
in_shape
,
w_shape
,
w_shape
,
r_shape
,
r_shape
,
...
@@ -405,7 +405,6 @@ TEST_CASE(rnn)
...
@@ -405,7 +405,6 @@ TEST_CASE(rnn)
std
::
size_t
num_dirct
=
2
;
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
}};
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
migraphx
::
shape
ih_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
batch_size
,
hidden_size
}};
migraphx
::
shape
ih_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
batch_size
,
hidden_size
}};
migraphx
::
shape
w_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
input_size
}};
migraphx
::
shape
w_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
hidden_size
,
input_size
}};
...
@@ -414,7 +413,175 @@ TEST_CASE(rnn)
...
@@ -414,7 +413,175 @@ TEST_CASE(rnn)
throws_shape
(
throws_shape
(
migraphx
::
op
::
rnn
{
migraphx
::
op
::
rnn
{
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn
::
forward
,
clip
},
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn_direction
::
forward
,
clip
},
in_shape
,
w_shape
,
r_shape
,
b_shape
,
ih_shape
);
}
}
TEST_CASE
(
gru
)
{
{
std
::
size_t
batch_size
=
2
;
std
::
size_t
seq_len
=
2
;
std
::
size_t
hidden_size
=
4
;
std
::
size_t
input_size
=
3
;
std
::
size_t
num_dirct
=
1
;
float
clip
=
0.0
f
;
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
migraphx
::
shape
w_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
3
*
hidden_size
,
input_size
}};
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
3
*
hidden_size
,
hidden_size
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
6
*
hidden_size
}};
migraphx
::
shape
ih_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
batch_size
,
hidden_size
}};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
num_dirct
,
batch_size
,
hidden_size
}},
migraphx
::
op
::
gru
{
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn_direction
::
forward
,
clip
},
in_shape
,
w_shape
,
r_shape
,
b_shape
,
ih_shape
);
}
{
std
::
size_t
batch_size
=
2
;
std
::
size_t
seq_len
=
2
;
std
::
size_t
hidden_size
=
4
;
std
::
size_t
input_size
=
3
;
std
::
size_t
num_dirct
=
1
;
float
clip
=
0.0
f
;
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
migraphx
::
shape
w_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
3
*
hidden_size
,
input_size
}};
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
3
*
hidden_size
,
hidden_size
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
6
*
hidden_size
}};
migraphx
::
shape
ih_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
batch_size
,
hidden_size
}};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
num_dirct
,
batch_size
,
hidden_size
}},
migraphx
::
op
::
gru
{
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn_direction
::
reverse
,
clip
},
in_shape
,
w_shape
,
r_shape
,
b_shape
,
ih_shape
);
}
{
std
::
size_t
batch_size
=
2
;
std
::
size_t
seq_len
=
2
;
std
::
size_t
hidden_size
=
4
;
std
::
size_t
input_size
=
3
;
std
::
size_t
num_dirct
=
2
;
float
clip
=
0.0
f
;
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
migraphx
::
shape
w_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
3
*
hidden_size
,
input_size
}};
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
3
*
hidden_size
,
hidden_size
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
6
*
hidden_size
}};
migraphx
::
shape
ih_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
batch_size
,
hidden_size
}};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
num_dirct
,
batch_size
,
hidden_size
}},
migraphx
::
op
::
gru
{
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn_direction
::
bidirectional
,
clip
},
in_shape
,
w_shape
,
r_shape
,
b_shape
,
ih_shape
);
}
{
std
::
size_t
batch_size
=
2
;
std
::
size_t
seq_len
=
2
;
std
::
size_t
hidden_size
=
4
;
std
::
size_t
input_size
=
3
;
std
::
size_t
num_dirct
=
1
;
float
clip
=
0.0
f
;
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
migraphx
::
shape
w_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
3
*
hidden_size
,
input_size
}};
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
3
*
hidden_size
,
hidden_size
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
6
*
hidden_size
}};
migraphx
::
shape
ih_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
batch_size
,
hidden_size
}};
throws_shape
(
migraphx
::
op
::
gru
{
hidden_size
+
1
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn_direction
::
forward
,
clip
},
in_shape
,
w_shape
,
r_shape
,
b_shape
,
ih_shape
);
}
{
std
::
size_t
batch_size
=
2
;
std
::
size_t
seq_len
=
2
;
std
::
size_t
hidden_size
=
4
;
std
::
size_t
input_size
=
3
;
std
::
size_t
num_dirct
=
1
;
float
clip
=
0.0
f
;
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
migraphx
::
shape
w_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
3
*
hidden_size
,
input_size
}};
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
3
*
hidden_size
,
hidden_size
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
6
*
hidden_size
}};
migraphx
::
shape
ih_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
batch_size
,
hidden_size
}};
throws_shape
(
migraphx
::
op
::
gru
{
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn_direction
::
bidirectional
,
clip
},
in_shape
,
w_shape
,
r_shape
,
b_shape
,
ih_shape
);
}
{
std
::
size_t
batch_size
=
2
;
std
::
size_t
seq_len
=
2
;
std
::
size_t
hidden_size
=
4
;
std
::
size_t
input_size
=
3
;
std
::
size_t
num_dirct
=
2
;
float
clip
=
0.0
f
;
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_type
,
{
seq_len
,
batch_size
,
input_size
}};
migraphx
::
shape
w_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
3
*
hidden_size
,
input_size
}};
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
3
*
hidden_size
,
hidden_size
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
6
*
hidden_size
}};
migraphx
::
shape
ih_shape
{
migraphx
::
shape
::
float_type
,
{
num_dirct
,
batch_size
,
hidden_size
}};
throws_shape
(
migraphx
::
op
::
gru
{
hidden_size
,
{
migraphx
::
op
::
tanh
{}},
migraphx
::
op
::
rnn_direction
::
forward
,
clip
},
in_shape
,
in_shape
,
w_shape
,
w_shape
,
r_shape
,
r_shape
,
...
...
Prev
1
2
Next
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