From 5cdcf33cfc85d4897560bcb2a8878f82e12ecde4 Mon Sep 17 00:00:00 2001 From: nihui Date: Mon, 26 Feb 2018 23:21:47 +0800 Subject: [PATCH] convert softmax, squeezenet model works :D --- tools/onnx/onnx2ncnn.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/onnx/onnx2ncnn.cpp b/tools/onnx/onnx2ncnn.cpp index abe0a679b..3e0badcd3 100644 --- a/tools/onnx/onnx2ncnn.cpp +++ b/tools/onnx/onnx2ncnn.cpp @@ -147,7 +147,7 @@ int main(int argc, char** argv) return -1; } - FILE* pp = stderr;//fopen(ncnn_prototxt, "wb"); + FILE* pp = fopen(ncnn_prototxt, "wb"); FILE* bp = fopen(ncnn_modelbin, "wb"); // magic @@ -373,6 +373,10 @@ int main(int argc, char** argv) } fprintf(pp, "%-16s", "Reshape"); } + else if (op == "Softmax") + { + fprintf(pp, "%-16s", "Softmax"); + } else if (op == "Transpose") { fprintf(pp, "%-16s", "Permute"); @@ -627,6 +631,11 @@ int main(int argc, char** argv) 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") { std::vector perm = get_node_attr_ai(node, "perm");