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
c8017873
Commit
c8017873
authored
Sep 26, 2018
by
Scott Thornton
Browse files
Formatting
parent
d3987641
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
9 deletions
+12
-9
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+5
-4
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+1
-1
test/op_shape_test.cpp
test/op_shape_test.cpp
+6
-4
No files found.
src/onnx/onnx.cpp
View file @
c8017873
...
@@ -105,7 +105,8 @@ struct onnx_parser
...
@@ -105,7 +105,8 @@ struct onnx_parser
parse_softmax
(
const
std
::
string
&
,
const
attribute_map
&
,
std
::
vector
<
instruction_ref
>
args
)
parse_softmax
(
const
std
::
string
&
,
const
attribute_map
&
,
std
::
vector
<
instruction_ref
>
args
)
{
{
auto
dims
=
args
.
front
()
->
get_shape
().
lens
();
auto
dims
=
args
.
front
()
->
get_shape
().
lens
();
auto
r
=
prog
.
add_instruction
(
op
::
reshape
{{
long
(
dims
[
0
]),
long
(
dims
[
1
]),
1
,
1
}},
args
.
front
());
auto
r
=
prog
.
add_instruction
(
op
::
reshape
{{
long
(
dims
[
0
]),
long
(
dims
[
1
]),
1
,
1
}},
args
.
front
());
auto
s
=
prog
.
add_instruction
(
op
::
softmax
{},
r
);
auto
s
=
prog
.
add_instruction
(
op
::
softmax
{},
r
);
return
prog
.
add_instruction
(
op
::
reshape
{{
long
(
dims
[
0
]),
long
(
dims
[
1
])}},
s
);
return
prog
.
add_instruction
(
op
::
reshape
{{
long
(
dims
[
0
]),
long
(
dims
[
1
])}},
s
);
}
}
...
...
test/onnx/onnx_test.cpp
View file @
c8017873
test/op_shape_test.cpp
View file @
c8017873
...
@@ -117,16 +117,18 @@ void reshape_shape()
...
@@ -117,16 +117,18 @@ void reshape_shape()
void
flatten_shape
()
void
flatten_shape
()
{
{
migraph
::
shape
input
{
migraph
::
shape
::
float_type
,
{
2
,
4
,
6
,
8
}};
migraph
::
shape
input
{
migraph
::
shape
::
float_type
,
{
2
,
4
,
6
,
8
}};
expect_shape
(
expect_shape
(
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
1
,
2
*
4
*
6
*
8
}},
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
1
,
2
*
4
*
6
*
8
}},
migraph
::
op
::
flatten
{
0
},
input
);
migraph
::
op
::
flatten
{
0
},
input
);
expect_shape
(
expect_shape
(
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
2
,
4
*
6
*
8
}},
migraph
::
op
::
flatten
{
1
},
input
);
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
2
,
4
*
6
*
8
}},
migraph
::
op
::
flatten
{
1
},
input
);
expect_shape
(
expect_shape
(
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
2
*
4
,
6
*
8
}},
migraph
::
op
::
flatten
{
2
},
input
);
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
2
*
4
,
6
*
8
}},
migraph
::
op
::
flatten
{
2
},
input
);
expect_shape
(
expect_shape
(
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
2
*
4
*
6
,
8
}},
migraph
::
op
::
flatten
{
3
},
input
);
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
2
*
4
*
6
,
8
}},
migraph
::
op
::
flatten
{
3
},
input
);
expect_shape
(
expect_shape
(
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
2
*
4
*
6
*
8
,
1
}},
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
2
*
4
*
6
*
8
,
1
}},
migraph
::
op
::
flatten
{
4
},
input
);
migraph
::
op
::
flatten
{
4
},
input
);
throws_shape
(
migraph
::
op
::
flatten
{
5
},
input
);
throws_shape
(
migraph
::
op
::
flatten
{
5
},
input
);
}
}
...
...
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