Commit 90aca5c3 authored by Paul's avatar Paul
Browse files

Formatting

parent 37236428
......@@ -14,7 +14,7 @@ struct loader
{
std::string file;
std::string type;
bool is_nhwc = false;
bool is_nhwc = false;
unsigned trim = 0;
void parse(argument_parser& ap)
......@@ -43,9 +43,9 @@ struct loader
p = parse_onnx(file);
else if(type == "tf")
p = parse_tf(file, is_nhwc);
if (trim > 0)
if(trim > 0)
{
auto last = std::prev(p.end(), trim);
auto last = std::prev(p.end(), trim);
p.remove_instructions(last, p.end());
}
return p;
......@@ -67,15 +67,19 @@ struct read : command<read>
struct verify : command<verify>
{
loader l;
double tolerance = 80;
double tolerance = 80;
bool per_instruction = false;
bool reduce = false;
void parse(argument_parser& ap)
{
bool reduce = false;
void parse(argument_parser& ap)
{
l.parse(ap);
ap.add(tolerance, {"--tolerance"}, ap.help("Tolerance for errors"));
ap.add(per_instruction, {"-i", "--per-instruction"}, ap.help("Verify each instruction"), ap.set_value(true));
ap.add(reduce, {"-r", "--reduce"}, ap.help("Reduce program and verify"), ap.set_value(true));
ap.add(per_instruction,
{"-i", "--per-instruction"},
ap.help("Verify each instruction"),
ap.set_value(true));
ap.add(
reduce, {"-r", "--reduce"}, ap.help("Reduce program and verify"), ap.set_value(true));
}
void run()
......
......@@ -41,8 +41,7 @@ argument run_gpu(program p)
program::parameter_map m;
for(auto&& x : p.get_parameter_shapes())
{
m[x.first] =
gpu::to_gpu(generate_argument(x.second, get_hash(x.first)));
m[x.first] = gpu::to_gpu(generate_argument(x.second, get_hash(x.first)));
}
auto out = gpu::from_gpu(p.eval(m));
std::cout << p << std::endl;
......@@ -81,8 +80,7 @@ void verify_instructions(const program& prog, double tolerance)
if(arg->name() == "@literal")
inputs.push_back(p.add_literal(arg->get_literal()));
else
inputs.push_back(
p.add_parameter(std::to_string(inputs.size()), arg->get_shape()));
inputs.push_back(p.add_parameter(std::to_string(inputs.size()), arg->get_shape()));
}
p.add_instruction(ins.get_operator(), inputs);
try
......@@ -101,7 +99,7 @@ void verify_instructions(const program& prog, double tolerance)
void verify_reduced(program p, int n, double tolerance)
{
auto last = std::prev(p.end(), n + 1);
auto last = std::prev(p.end(), n + 1);
p.remove_instructions(last, p.end());
std::cout << "Verify: " << std::endl;
std::cout << p << std::endl;
......@@ -110,7 +108,7 @@ void verify_reduced(program p, int n, double tolerance)
void verify_reduced_program(program p, double tolerance)
{
auto n = std::distance(p.begin(), p.end());
auto n = std::distance(p.begin(), p.end());
for(std::size_t i = 0; i < n; i++)
{
verify_reduced(p, i, tolerance);
......
......@@ -13,7 +13,6 @@ void verify_program(const std::string& name, program p, double tolerance = 100);
void verify_instructions(const program& prog, double tolerance = 80);
void verify_reduced_program(program p, double tolerance = 80);
} // namespace MIGRAPHX_INLINE_NS
} // namespace driver
} // namespace migraphx
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment