Commit 85b35f92 authored by Shucai Xiao's avatar Shucai Xiao
Browse files

clang format

parent 6cda085f
...@@ -260,19 +260,20 @@ struct onnx_parser ...@@ -260,19 +260,20 @@ struct onnx_parser
return prog.add_instruction(op, std::move(args)); return prog.add_instruction(op, std::move(args));
} }
// instruction_ref // instruction_ref
// parse_softmax(const std::string&, const attribute_map&, std::vector<instruction_ref> args) // parse_softmax(const std::string&, const attribute_map&, std::vector<instruction_ref> args)
// { // {
// auto dims = args.front()->get_shape().lens(); // auto dims = args.front()->get_shape().lens();
// auto r = // auto r =
// prog.add_instruction(op::reshape{{long(dims[0]), long(dims[1]), 1, 1}}, args.front()); // prog.add_instruction(op::reshape{{long(dims[0]), long(dims[1]), 1, 1}},
// auto s = prog.add_instruction(op::softmax{}, r); // args.front());
// return prog.add_instruction(op::reshape{{long(dims[0]), long(dims[1])}}, s); // auto s = prog.add_instruction(op::softmax{}, r);
// } // return prog.add_instruction(op::reshape{{long(dims[0]), long(dims[1])}}, s);
// }
instruction_ref parse_softmax(const std::string&, instruction_ref parse_softmax(const std::string&,
const attribute_map& attributes, const attribute_map& attributes,
std::vector<instruction_ref> args) std::vector<instruction_ref> args)
{ {
int axis = 1; int axis = 1;
if(contains(attributes, "axis")) if(contains(attributes, "axis"))
...@@ -473,15 +474,16 @@ struct onnx_parser ...@@ -473,15 +474,16 @@ struct onnx_parser
op::reshape op; op::reshape op;
if(args.size() == 1) if(args.size() == 1)
{ {
if (contains(attributes, "shape")) if(contains(attributes, "shape"))
{ {
literal s = parse_value(attributes.at("shape")); literal s = parse_value(attributes.at("shape"));
s.visit([&](auto v) { copy(v, std::back_inserter(op.dims)); }); s.visit([&](auto v) { copy(v, std::back_inserter(op.dims)); });
} }
else else
{ {
MIGRAPHX_THROW("Parse_reshape: shape attribute is needed when only one argument is provided!"); MIGRAPHX_THROW(
} "Parse_reshape: shape attribute is needed when only one argument is provided!");
}
} }
if(args.size() == 2) if(args.size() == 2)
{ {
...@@ -491,7 +493,7 @@ struct onnx_parser ...@@ -491,7 +493,7 @@ struct onnx_parser
s.visit([&](auto v) { copy(v, std::back_inserter(op.dims)); }); s.visit([&](auto v) { copy(v, std::back_inserter(op.dims)); });
} }
if (!args[0]->get_shape().standard()) if(!args[0]->get_shape().standard())
{ {
args[0] = prog.add_instruction(op::contiguous{}, args[0]); args[0] = prog.add_instruction(op::contiguous{}, args[0]);
} }
......
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