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
184804b4
Commit
184804b4
authored
Jul 17, 2019
by
Shucai Xiao
Browse files
remove unnecessary changes
parent
ade4bccd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
31 deletions
+12
-31
src/include/migraphx/generate.hpp
src/include/migraphx/generate.hpp
+1
-9
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+8
-21
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+3
-1
No files found.
src/include/migraphx/generate.hpp
View file @
184804b4
...
@@ -81,15 +81,7 @@ template <class T>
...
@@ -81,15 +81,7 @@ template <class T>
std
::
vector
<
T
>
generate_tensor_data
(
const
migraphx
::
shape
&
s
,
unsigned
long
seed
=
0
)
std
::
vector
<
T
>
generate_tensor_data
(
const
migraphx
::
shape
&
s
,
unsigned
long
seed
=
0
)
{
{
std
::
vector
<
T
>
result
(
s
.
elements
());
std
::
vector
<
T
>
result
(
s
.
elements
());
shape
::
type_t
type
=
s
.
type
();
std
::
generate
(
result
.
begin
(),
result
.
end
(),
xorshf96_generator
<
T
>
{
seed
});
if
(
type
==
shape
::
int64_type
or
type
==
shape
::
int32_type
)
{
std
::
generate
(
result
.
begin
(),
result
.
end
(),
[]
{
return
1
;
});
}
else
{
std
::
generate
(
result
.
begin
(),
result
.
end
(),
xorshf96_generator
<
T
>
{
seed
});
}
// std::generate(result.begin(), result.end(), [&]{ return seed % 7; });
// std::generate(result.begin(), result.end(), [&]{ return seed % 7; });
// std::generate(result.begin(), result.end(), []{ return 1; });
// std::generate(result.begin(), result.end(), []{ return 1; });
...
...
src/onnx/onnx.cpp
View file @
184804b4
...
@@ -261,28 +261,15 @@ struct onnx_parser
...
@@ -261,28 +261,15 @@ struct onnx_parser
return
prog
.
add_instruction
(
op
,
std
::
move
(
args
));
return
prog
.
add_instruction
(
op
,
std
::
move
(
args
));
}
}
// instruction_ref
instruction_ref
// 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 r =
// prog.add_instruction(op::reshape{{long(dims[0]), long(dims[1]), 1, 1}},
// args.front());
// auto s = prog.add_instruction(op::softmax{}, r);
// return prog.add_instruction(op::reshape{{long(dims[0]), long(dims[1])}}, s);
// }
instruction_ref
parse_softmax
(
const
std
::
string
&
,
const
attribute_map
&
attributes
,
std
::
vector
<
instruction_ref
>
args
)
{
{
int
axis
=
1
;
auto
dims
=
args
.
front
()
->
get_shape
().
lens
();
if
(
contains
(
attributes
,
"axis"
))
auto
r
=
{
prog
.
add_instruction
(
op
::
reshape
{{
long
(
dims
[
0
]),
long
(
dims
[
1
]),
1
,
1
}},
axis
=
parse_value
(
attributes
.
at
(
"axis"
)).
at
<
int
>
();
args
.
front
());
}
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
::
softmax
{
axis
},
std
::
move
(
args
));
}
}
instruction_ref
parse_logsoftmax
(
const
std
::
string
&
,
instruction_ref
parse_logsoftmax
(
const
std
::
string
&
,
...
...
test/onnx/onnx_test.cpp
View file @
184804b4
...
@@ -423,7 +423,9 @@ TEST_CASE(softmax_test)
...
@@ -423,7 +423,9 @@ TEST_CASE(softmax_test)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
l0
=
p
.
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
3
}});
auto
l0
=
p
.
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
3
}});
p
.
add_instruction
(
migraphx
::
op
::
softmax
{
1
},
l0
);
auto
r
=
p
.
add_instruction
(
migraphx
::
op
::
reshape
{{
1
,
3
,
1
,
1
}},
l0
);
auto
s
=
p
.
add_instruction
(
migraphx
::
op
::
softmax
{},
r
);
p
.
add_instruction
(
migraphx
::
op
::
reshape
{{
1
,
3
}},
s
);
auto
prog
=
migraphx
::
parse_onnx
(
"softmax_test.onnx"
);
auto
prog
=
migraphx
::
parse_onnx
(
"softmax_test.onnx"
);
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
...
...
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