Skip to content

Commit

Permalink
resolve onnx Split conversion with empty split attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui committed Oct 30, 2019
1 parent 96a2499 commit d5d7886
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions tools/onnx/onnx2ncnn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2072,15 +2072,25 @@ int main(int argc, char** argv)
{
int axis = get_node_attr_i(node, "axis", 0);
std::vector<int> split = get_node_attr_ai(node, "split");
if (axis < 1 || split.size() < 2)
fprintf(stderr, "Unsupported split attributes !\n");
if (axis < 1)
fprintf(stderr, "Unsupported split axis !\n");

fprintf(pp, " -23300=%d", output_size);
for (int i=0; i< split.size() - 1; i++)
if (split.empty())
{
fprintf(pp, ",%d", split[i]);
for (int i=0; i<output_size; i++)
{
fprintf(pp, ",-233");
}
}
else
{
for (int i=0; i<split.size() - 1; i++)
{
fprintf(pp, ",%d", split[i]);
}
fprintf(pp, ",-233");
}
fprintf(pp, ",-233");
fprintf(pp, " 1=%d", axis - 1);
}
else if (op == "Sqrt")
Expand Down

0 comments on commit d5d7886

Please sign in to comment.