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
a354f8ea
Commit
a354f8ea
authored
Jul 24, 2019
by
Shucai Xiao
Browse files
Merge branch 'test_bert' into parse_softmax_using_new_impl
parents
46ad8d83
3107fda5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
10 deletions
+27
-10
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+2
-10
src/tf/tf.cpp
src/tf/tf.cpp
+9
-0
test/tf/gather_test.pb
test/tf/gather_test.pb
+0
-0
test/tf/tf_test.cpp
test/tf/tf_test.cpp
+16
-0
No files found.
src/onnx/onnx.cpp
View file @
a354f8ea
...
...
@@ -426,16 +426,8 @@ struct onnx_parser
op
::
reshape
op
;
if
(
args
.
size
()
==
1
)
{
if
(
contains
(
attributes
,
"shape"
))
{
literal
s
=
parse_value
(
attributes
.
at
(
"shape"
));
s
.
visit
([
&
](
auto
v
)
{
copy
(
v
,
std
::
back_inserter
(
op
.
dims
));
});
}
else
{
MIGRAPHX_THROW
(
"Parse_reshape: shape attribute is needed when only one argument is provided!"
);
}
literal
s
=
parse_value
(
attributes
.
at
(
"shape"
));
s
.
visit
([
&
](
auto
v
)
{
copy
(
v
,
std
::
back_inserter
(
op
.
dims
));
});
}
if
(
args
.
size
()
==
2
)
{
...
...
src/tf/tf.cpp
View file @
a354f8ea
...
...
@@ -174,6 +174,7 @@ struct tf_parser
add_mem_op
(
"DepthwiseConv2dNative"
,
&
tf_parser
::
parse_depthwiseconv
);
add_mem_op
(
"ExpandDims"
,
&
tf_parser
::
parse_expanddims
,
false
);
add_mem_op
(
"FusedBatchNorm"
,
&
tf_parser
::
parse_batchnorm
);
add_mem_op
(
"GatherV2"
,
&
tf_parser
::
parse_gather
,
false
);
add_mem_op
(
"MatMul"
,
&
tf_parser
::
parse_matmul
,
false
);
add_mem_op
(
"MaxPool"
,
&
tf_parser
::
parse_pooling
);
add_mem_op
(
"Mean"
,
&
tf_parser
::
parse_mean
);
...
...
@@ -525,6 +526,14 @@ struct tf_parser
return
prog
.
add_instruction
(
op
::
reshape
{
new_dims
},
args
[
0
]);
}
instruction_ref
parse_gather
(
const
std
::
string
&
,
const
attribute_map
&
,
std
::
vector
<
instruction_ref
>
args
)
{
int
axis
=
args
[
2
]
->
eval
().
at
<
int32_t
>
();
op
::
gather
op
{
axis
};
return
prog
.
add_instruction
(
op
,
{
args
[
0
],
args
[
1
]});
}
instruction_ref
parse_matmul
(
const
std
::
string
&
,
attribute_map
attributes
,
std
::
vector
<
instruction_ref
>
args
)
{
...
...
test/tf/gather_test.pb
0 → 100644
View file @
a354f8ea
File added
test/tf/tf_test.cpp
View file @
a354f8ea
...
...
@@ -209,6 +209,22 @@ TEST_CASE(expanddims_test_neg_dims)
EXPECT
(
p
==
prog
);
}
TEST_CASE
(
gather_test
)
{
migraphx
::
program
p
;
auto
l0
=
p
.
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
4
}});
auto
l1
=
p
.
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
migraphx
::
shape
::
int32_type
,
{
2
}},
{
1
,
1
}});
p
.
add_literal
(
1
);
int
axis
=
1
;
p
.
add_instruction
(
migraphx
::
op
::
gather
{
axis
},
l0
,
l1
);
auto
prog
=
optimize_tf
(
"gather_test.pb"
,
false
);
EXPECT
(
p
==
prog
);
}
TEST_CASE
(
identity_test
)
{
migraphx
::
program
p
;
...
...
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