Browse Source

preserve the very first onnx constant dimension size when we guess it is not the batchsize one, fix #2487

tags/20210322
nihuini 5 years ago
parent
commit
f47fbcbf83
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      tools/onnx/onnx2ncnn.cpp

+ 8
- 0
tools/onnx/onnx2ncnn.cpp View File

@@ -2606,11 +2606,19 @@ int main(int argc, char** argv)
else if (M.dims_size() == 2)
{
fprintf(pp, " 0=%d", (int)M.dims(1));
if (M.dims(0) != 1)
{
fprintf(pp, " 1=%d", (int)M.dims(0));
}
}
else if (M.dims_size() == 3)
{
fprintf(pp, " 0=%d", (int)M.dims(2));
fprintf(pp, " 1=%d", (int)M.dims(1));
if (M.dims(0) != 1)
{
fprintf(pp, " 2=%d", (int)M.dims(0));
}
}
else if (M.dims_size() == 4)
{


Loading…
Cancel
Save