Browse Source

convert softmax, squeezenet model works :D

tags/20180314
nihui 8 years ago
parent
commit
5cdcf33cfc
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      tools/onnx/onnx2ncnn.cpp

+ 10
- 1
tools/onnx/onnx2ncnn.cpp View File

@@ -147,7 +147,7 @@ int main(int argc, char** argv)
return -1; return -1;
} }


FILE* pp = stderr;//fopen(ncnn_prototxt, "wb");
FILE* pp = fopen(ncnn_prototxt, "wb");
FILE* bp = fopen(ncnn_modelbin, "wb"); FILE* bp = fopen(ncnn_modelbin, "wb");


// magic // magic
@@ -373,6 +373,10 @@ int main(int argc, char** argv)
} }
fprintf(pp, "%-16s", "Reshape"); fprintf(pp, "%-16s", "Reshape");
} }
else if (op == "Softmax")
{
fprintf(pp, "%-16s", "Softmax");
}
else if (op == "Transpose") else if (op == "Transpose")
{ {
fprintf(pp, "%-16s", "Permute"); fprintf(pp, "%-16s", "Permute");
@@ -627,6 +631,11 @@ int main(int argc, char** argv)
fprintf(pp, " 2=%d", shape[1]); fprintf(pp, " 2=%d", shape[1]);
} }
} }
else if (op == "Softmax")
{
int axis = get_node_attr_i(node, "axis", 1);
fprintf(pp, " 0=%d", axis-1);
}
else if (op == "Transpose") else if (op == "Transpose")
{ {
std::vector<int> perm = get_node_attr_ai(node, "perm"); std::vector<int> perm = get_node_attr_ai(node, "perm");


Loading…
Cancel
Save