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
60f75082
Commit
60f75082
authored
Dec 03, 2018
by
Khalique
Browse files
combined variadic functions
parent
78ee6fbe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
33 deletions
+14
-33
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+14
-33
No files found.
src/onnx/onnx.cpp
View file @
60f75082
...
@@ -72,9 +72,9 @@ struct onnx_parser
...
@@ -72,9 +72,9 @@ struct onnx_parser
add_binary_op
(
"Mul"
,
op
::
mul
{});
add_binary_op
(
"Mul"
,
op
::
mul
{});
add_binary_op
(
"Sub"
,
op
::
sub
{});
add_binary_op
(
"Sub"
,
op
::
sub
{});
add_
mem
_op
(
"Sum"
,
&
onnx_parser
::
parse_sum
);
add_
variadic
_op
(
"Sum"
,
op
::
add
{}
);
add_
mem
_op
(
"Max"
,
&
onnx_parser
::
parse_
max
);
add_
variadic
_op
(
"Max"
,
op
::
max
{}
);
add_
mem
_op
(
"Min"
,
&
onnx_parser
::
parse_
min
);
add_
variadic
_op
(
"Min"
,
op
::
min
{}
);
add_mem_op
(
"ImageScaler"
,
&
onnx_parser
::
parse_imagescaler
);
add_mem_op
(
"ImageScaler"
,
&
onnx_parser
::
parse_imagescaler
);
add_mem_op
(
"LeakyRelu"
,
&
onnx_parser
::
parse_leaky_relu
);
add_mem_op
(
"LeakyRelu"
,
&
onnx_parser
::
parse_leaky_relu
);
...
@@ -190,37 +190,18 @@ struct onnx_parser
...
@@ -190,37 +190,18 @@ struct onnx_parser
});
});
}
}
instruction_ref
template
<
class
T
>
parse_sum
(
const
std
::
string
&
,
const
attribute_map
&
,
std
::
vector
<
instruction_ref
>
args
)
void
{
add_variadic_op
(
std
::
string
name
,
T
x
)
return
std
::
accumulate
(
std
::
next
(
args
.
begin
()),
args
.
end
(),
args
.
front
(),
[
this
](
instruction_ref
a
,
instruction_ref
b
)
{
return
add_broadcastable_binary_op
(
a
,
b
,
op
::
add
{});
});
}
instruction_ref
parse_max
(
const
std
::
string
&
,
const
attribute_map
&
,
std
::
vector
<
instruction_ref
>
args
)
{
{
return
std
::
accumulate
(
std
::
next
(
args
.
begin
()),
ops
.
emplace
(
name
,
[
this
,
x
](
attribute_map
,
std
::
vector
<
instruction_ref
>
args
)
{
args
.
end
(),
return
std
::
accumulate
(
std
::
next
(
args
.
begin
()),
args
.
front
(),
args
.
end
(),
[
this
](
instruction_ref
a
,
instruction_ref
b
)
{
args
.
front
(),
return
add_broadcastable_binary_op
(
a
,
b
,
op
::
max
{});
[
this
,
x
](
instruction_ref
a
,
instruction_ref
b
)
{
});
return
add_broadcastable_binary_op
(
a
,
b
,
x
);
}
});
});
instruction_ref
parse_min
(
const
std
::
string
&
,
const
attribute_map
&
,
std
::
vector
<
instruction_ref
>
args
)
{
return
std
::
accumulate
(
std
::
next
(
args
.
begin
()),
args
.
end
(),
args
.
front
(),
[
this
](
instruction_ref
a
,
instruction_ref
b
)
{
return
add_broadcastable_binary_op
(
a
,
b
,
op
::
min
{});
});
}
}
instruction_ref
instruction_ref
...
...
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