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
a2f3bd24
Commit
a2f3bd24
authored
May 02, 2018
by
Paul
Browse files
Formatting
parent
e59e3058
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
14 deletions
+10
-14
onnx/read_onnx.cpp
onnx/read_onnx.cpp
+1
-4
src/program.cpp
src/program.cpp
+9
-10
No files found.
onnx/read_onnx.cpp
View file @
a2f3bd24
...
@@ -46,10 +46,7 @@ struct onnx_parser
...
@@ -46,10 +46,7 @@ struct onnx_parser
std
::
unordered_map
<
std
::
string
,
rtg
::
instruction
*>
instructions
;
std
::
unordered_map
<
std
::
string
,
rtg
::
instruction
*>
instructions
;
rtg
::
program
prog
=
rtg
::
program
();
rtg
::
program
prog
=
rtg
::
program
();
std
::
unordered_map
<
std
::
unordered_map
<
std
::
string
,
op_func
>
ops
;
std
::
string
,
op_func
>
ops
;
onnx_parser
()
onnx_parser
()
{
{
...
...
src/program.cpp
View file @
a2f3bd24
...
@@ -12,19 +12,17 @@ struct program_impl
...
@@ -12,19 +12,17 @@ struct program_impl
std
::
list
<
instruction
>
instructions
;
std
::
list
<
instruction
>
instructions
;
};
};
program
::
program
()
program
::
program
()
:
impl
(
std
::
make_unique
<
program_impl
>
())
{}
:
impl
(
std
::
make_unique
<
program_impl
>
())
{}
program
::
program
(
program
&&
)
noexcept
=
default
;
program
::
program
(
program
&&
)
noexcept
=
default
;
program
&
program
::
operator
=
(
program
&&
)
=
default
;
program
&
program
::
operator
=
(
program
&&
)
=
default
;
program
::~
program
()
=
default
;
program
::~
program
()
=
default
;
instruction
*
program
::
add_instruction
(
operation
op
,
std
::
vector
<
instruction
*>
args
)
instruction
*
program
::
add_instruction
(
operation
op
,
std
::
vector
<
instruction
*>
args
)
{
{
assert
(
std
::
all_of
(
assert
(
args
.
begin
(),
args
.
end
(),
[
&
](
instruction
*
x
)
{
return
has_instruction
(
x
);
})
&&
std
::
all_of
(
args
.
begin
(),
args
.
end
(),
[
&
](
instruction
*
x
)
{
return
has_instruction
(
x
);
})
&&
"Argument is not an exisiting instruction"
);
"Argument is not an exisiting instruction"
);
std
::
vector
<
shape
>
shapes
(
args
.
size
());
std
::
vector
<
shape
>
shapes
(
args
.
size
());
std
::
transform
(
std
::
transform
(
args
.
begin
(),
args
.
end
(),
shapes
.
begin
(),
[](
instruction
*
ins
)
{
return
ins
->
result
;
});
args
.
begin
(),
args
.
end
(),
shapes
.
begin
(),
[](
instruction
*
ins
)
{
return
ins
->
result
;
});
...
@@ -48,9 +46,10 @@ instruction* program::add_parameter(std::string name, shape s)
...
@@ -48,9 +46,10 @@ instruction* program::add_parameter(std::string name, shape s)
bool
program
::
has_instruction
(
const
instruction
*
ins
)
const
bool
program
::
has_instruction
(
const
instruction
*
ins
)
const
{
{
return
std
::
find_if
(
impl
->
instructions
.
begin
(),
impl
->
instructions
.
end
(),
[
&
](
const
instruction
&
x
)
{
return
std
::
find_if
(
impl
->
instructions
.
begin
(),
return
ins
==
std
::
addressof
(
x
);
impl
->
instructions
.
end
(),
})
!=
impl
->
instructions
.
end
();
[
&
](
const
instruction
&
x
)
{
return
ins
==
std
::
addressof
(
x
);
})
!=
impl
->
instructions
.
end
();
}
}
literal
program
::
eval
(
std
::
unordered_map
<
std
::
string
,
argument
>
params
)
const
literal
program
::
eval
(
std
::
unordered_map
<
std
::
string
,
argument
>
params
)
const
...
...
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