Commit e8a997ed authored by Khalique's avatar Khalique
Browse files

add onnx parsing

parent 5b888363
......@@ -74,6 +74,7 @@ struct onnx_parser
add_mem_op("Unsqueeze", &onnx_parser::parse_unsqueeze);
add_mem_op("Slice", &onnx_parser::parse_slice);
add_mem_op("Concat", &onnx_parser::parse_concat);
add_mem_op("Transpose", &onnx_parser::parse_transpose);
}
template <class F>
......@@ -361,6 +362,19 @@ struct onnx_parser
return prog.add_instruction(migraph::op::add{}, img_scaled, bias_bcast);
}
instruction_ref parse_transpose(const std::string&,
attribute_map attributes,
std::vector<instruction_ref> args)
{
std::vector<int64_t> perm{};
if(contains(attributes, "perm"))
{
auto&& perm_vals = attributes["perm"].ints();
perm = std::vector<int64_t>(perm_vals.begin(), perm_vals.end());
}
return prog.add_instruction(migraph::op::transpose{perm}, args.front());
}
void parse_from(std::istream& is)
{
onnx::ModelProto model;
......
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