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
f0c57f28
Commit
f0c57f28
authored
Jun 05, 2019
by
Paul
Browse files
Shortedn call to add args
parent
90aca5c3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
13 deletions
+13
-13
src/driver/argument_parser.hpp
src/driver/argument_parser.hpp
+2
-2
src/driver/command.hpp
src/driver/command.hpp
+1
-1
src/driver/main.cpp
src/driver/main.cpp
+10
-10
No files found.
src/driver/argument_parser.hpp
View file @
f0c57f28
...
...
@@ -62,7 +62,7 @@ struct argument_parser
};
template
<
class
T
,
class
...
Fs
>
void
add
(
T
&
x
,
std
::
vector
<
std
::
string
>
flags
,
Fs
...
fs
)
void
operator
()
(
T
&
x
,
std
::
vector
<
std
::
string
>
flags
,
Fs
...
fs
)
{
arguments
.
push_back
({
flags
,
[
&
](
auto
&&
,
const
std
::
vector
<
std
::
string
>&
params
)
{
if
(
params
.
empty
())
...
...
@@ -77,7 +77,7 @@ struct argument_parser
}
template
<
class
...
Fs
>
void
add
(
std
::
nullptr_t
x
,
std
::
vector
<
std
::
string
>
flags
,
Fs
...
fs
)
void
operator
()
(
std
::
nullptr_t
x
,
std
::
vector
<
std
::
string
>
flags
,
Fs
...
fs
)
{
arguments
.
push_back
({
flags
});
...
...
src/driver/command.hpp
View file @
f0c57f28
...
...
@@ -32,7 +32,7 @@ void run_command(std::vector<std::string> args, bool add_help = false)
T
x
;
argument_parser
ap
;
if
(
add_help
)
ap
.
add
(
nullptr
,
{
"-h"
,
"--help"
},
ap
.
help
(
"Show help"
),
ap
.
show_help
());
ap
(
nullptr
,
{
"-h"
,
"--help"
},
ap
.
help
(
"Show help"
),
ap
.
show_help
());
x
.
parse
(
ap
);
if
(
ap
.
parse
(
args
))
return
;
...
...
src/driver/main.cpp
View file @
f0c57f28
...
...
@@ -19,13 +19,13 @@ struct loader
void
parse
(
argument_parser
&
ap
)
{
ap
.
add
(
file
,
{},
ap
.
metavar
(
"<input file>"
));
ap
.
add
(
type
,
{
"--onnx"
},
ap
.
help
(
"Load as onnx"
),
ap
.
set_value
(
"onnx"
));
ap
.
add
(
type
,
{
"--tf"
},
ap
.
help
(
"Load as tensorflow"
),
ap
.
set_value
(
"tf"
));
ap
.
add
(
is_nhwc
,
{
"--nhwc"
},
ap
.
help
(
"Treat tensorflow format as nhwc"
),
ap
.
set_value
(
true
));
ap
.
add
(
ap
(
file
,
{},
ap
.
metavar
(
"<input file>"
));
ap
(
type
,
{
"--onnx"
},
ap
.
help
(
"Load as onnx"
),
ap
.
set_value
(
"onnx"
));
ap
(
type
,
{
"--tf"
},
ap
.
help
(
"Load as tensorflow"
),
ap
.
set_value
(
"tf"
));
ap
(
is_nhwc
,
{
"--nhwc"
},
ap
.
help
(
"Treat tensorflow format as nhwc"
),
ap
.
set_value
(
true
));
ap
(
is_nhwc
,
{
"--nchw"
},
ap
.
help
(
"Treat tensorflow format as nchw"
),
ap
.
set_value
(
false
));
ap
.
add
(
trim
,
{
"--trim"
,
"-t"
},
ap
.
help
(
"Trim instructions from the end"
));
ap
(
trim
,
{
"--trim"
,
"-t"
},
ap
.
help
(
"Trim instructions from the end"
));
}
program
load
()
...
...
@@ -73,12 +73,12 @@ struct verify : command<verify>
void
parse
(
argument_parser
&
ap
)
{
l
.
parse
(
ap
);
ap
.
add
(
tolerance
,
{
"--tolerance"
},
ap
.
help
(
"Tolerance for errors"
));
ap
.
add
(
per_instruction
,
ap
(
tolerance
,
{
"--tolerance"
},
ap
.
help
(
"Tolerance for errors"
));
ap
(
per_instruction
,
{
"-i"
,
"--per-instruction"
},
ap
.
help
(
"Verify each instruction"
),
ap
.
set_value
(
true
));
ap
.
add
(
ap
(
reduce
,
{
"-r"
,
"--reduce"
},
ap
.
help
(
"Reduce program and verify"
),
ap
.
set_value
(
true
));
}
...
...
@@ -113,7 +113,7 @@ struct main_command
}
void
parse
(
argument_parser
&
ap
)
{
ap
.
add
(
nullptr
,
{
"-h"
,
"--help"
},
ap
.
help
(
"Show help"
),
ap
.
show_help
(
get_command_help
()));
ap
(
nullptr
,
{
"-h"
,
"--help"
},
ap
.
help
(
"Show help"
),
ap
.
show_help
(
get_command_help
()));
}
void
run
()
{}
...
...
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