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
601122f8
Commit
601122f8
authored
Sep 17, 2018
by
Paul
Browse files
Fix softmax in onnx file
parent
0418f719
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
+5
-4
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+1
-1
src/onnx/verify_onnx.cpp
src/onnx/verify_onnx.cpp
+2
-0
test/gpu/miopen.cpp
test/gpu/miopen.cpp
+2
-3
No files found.
src/onnx/onnx.cpp
View file @
601122f8
...
...
@@ -105,7 +105,7 @@ struct onnx_parser
parse_softmax
(
const
std
::
string
&
,
const
attribute_map
&
,
std
::
vector
<
instruction_ref
>
args
)
{
auto
dims
=
args
.
front
()
->
get_shape
().
lens
();
auto
r
=
prog
.
add_instruction
(
reshape
{{
long
(
dims
[
0
]),
1
,
1
,
long
(
dims
[
1
])}},
args
.
front
());
auto
r
=
prog
.
add_instruction
(
reshape
{{
long
(
dims
[
0
]),
long
(
dims
[
1
])
,
1
,
1
}},
args
.
front
());
auto
s
=
prog
.
add_instruction
(
softmax
{},
r
);
return
prog
.
add_instruction
(
reshape
{{
long
(
dims
[
0
]),
long
(
dims
[
1
])}},
s
);
}
...
...
src/onnx/verify_onnx.cpp
View file @
601122f8
...
...
@@ -51,6 +51,8 @@ void verify_program(const std::string& name, F f, double tolerance = 100)
auto
x
=
run_cpu
(
f
);
auto
y
=
run_gpu
(
f
);
migraph
::
verify_args
(
name
,
x
,
y
,
tolerance
);
// std::cout << "cpu: " << x << std::endl;
// std::cout << "gpu: " << y << std::endl;
}
void
verify_instructions
(
const
migraph
::
program
&
prog
,
double
tolerance
=
80
)
...
...
test/gpu/miopen.cpp
View file @
601122f8
...
...
@@ -251,7 +251,7 @@ struct test_softmax2
migraph
::
program
create_program
()
const
{
migraph
::
program
p
;
auto
x
=
p
.
add_parameter
(
"x"
,
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
1
,
1000
}});
auto
x
=
p
.
add_parameter
(
"x"
,
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
1
,
1000
,
1
,
1
}});
p
.
add_instruction
(
migraph
::
softmax
{},
x
);
return
p
;
}
...
...
@@ -539,8 +539,7 @@ int main()
verify_program
<
test_add_broadcast4
>
();
verify_program
<
test_add_broadcast5
>
();
verify_program
<
test_softmax
>
();
// TODO: Add reshapes to make this a valid test case
// verify_program<test_softmax2>();
verify_program
<
test_softmax2
>
();
verify_program
<
test_conv
>
();
verify_program
<
test_conv_relu
>
();
verify_program
<
test_add_relu
>
();
...
...
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