Commit 43ee9854 authored by Paul's avatar Paul
Browse files

Formatting

parent 0fc52912
...@@ -58,11 +58,10 @@ struct onnx_parser ...@@ -58,11 +58,10 @@ struct onnx_parser
add_generic_op("Relu", activation{"relu"}); add_generic_op("Relu", activation{"relu"});
add_generic_op("Sub", sub{}); add_generic_op("Sub", sub{});
add_mem_op("Constant",&onnx_parser::parse_constant); add_mem_op("Constant", &onnx_parser::parse_constant);
add_mem_op("Conv",&onnx_parser::parse_conv); add_mem_op("Conv", &onnx_parser::parse_conv);
add_mem_op("MaxPool",&onnx_parser::parse_pooling); add_mem_op("MaxPool", &onnx_parser::parse_pooling);
add_mem_op("Reshape",&onnx_parser::parse_reshape); add_mem_op("Reshape", &onnx_parser::parse_reshape);
} }
template <class F> template <class F>
...@@ -79,7 +78,7 @@ struct onnx_parser ...@@ -79,7 +78,7 @@ struct onnx_parser
}); });
} }
template<class T> template <class T>
void add_generic_op(std::string name, T x) void add_generic_op(std::string name, T x)
{ {
ops.emplace(name, [this, x](attribute_map attributes, std::vector<instruction_ref> args) { ops.emplace(name, [this, x](attribute_map attributes, std::vector<instruction_ref> args) {
...@@ -99,7 +98,9 @@ struct onnx_parser ...@@ -99,7 +98,9 @@ struct onnx_parser
}); });
} }
instruction_ref parse_conv(std::string, attribute_map attributes, std::vector<instruction_ref> args) { instruction_ref
parse_conv(std::string, attribute_map attributes, std::vector<instruction_ref> args)
{
convolution op; convolution op;
if(contains(attributes, "pads")) if(contains(attributes, "pads"))
{ {
...@@ -123,7 +124,9 @@ struct onnx_parser ...@@ -123,7 +124,9 @@ struct onnx_parser
return prog.add_instruction(op, args); return prog.add_instruction(op, args);
} }
instruction_ref parse_pooling(std::string, attribute_map attributes, std::vector<instruction_ref> args) { instruction_ref
parse_pooling(std::string, attribute_map attributes, std::vector<instruction_ref> args)
{
pooling op{"max"}; pooling op{"max"};
// for(auto&& p:attributes) std::cout << p.first << std::endl; // for(auto&& p:attributes) std::cout << p.first << std::endl;
if(contains(attributes, "pads")) if(contains(attributes, "pads"))
...@@ -141,7 +144,9 @@ struct onnx_parser ...@@ -141,7 +144,9 @@ struct onnx_parser
return prog.add_instruction(op, args); return prog.add_instruction(op, args);
} }
instruction_ref parse_reshape(std::string, attribute_map attributes, std::vector<instruction_ref> args) { instruction_ref
parse_reshape(std::string, attribute_map attributes, std::vector<instruction_ref> args)
{
reshape op; reshape op;
if(args.size() == 1) if(args.size() == 1)
{ {
...@@ -156,7 +161,9 @@ struct onnx_parser ...@@ -156,7 +161,9 @@ struct onnx_parser
return prog.add_instruction(op, args[0]); return prog.add_instruction(op, args[0]);
} }
instruction_ref parse_constant(std::string, attribute_map attributes, std::vector<instruction_ref>) { instruction_ref
parse_constant(std::string, attribute_map attributes, std::vector<instruction_ref>)
{
literal v = parse_value(attributes.at("value")); literal v = parse_value(attributes.at("value"));
return prog.add_literal(v); return prog.add_literal(v);
} }
......
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