From 7460af8369e140f821e761d52a9b50be1f4d6bef Mon Sep 17 00:00:00 2001 From: daquexian Date: Mon, 11 Nov 2019 00:18:46 +0800 Subject: [PATCH] Eliminate dropout by custom onnx optimizer --- third_party/onnx | 2 +- tools/onnx2bnn/OnnxConverter.cpp | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/third_party/onnx b/third_party/onnx index 20835f8..9f70c11 160000 --- a/third_party/onnx +++ b/third_party/onnx @@ -1 +1 @@ -Subproject commit 20835f8f238a232de2f1540fc109de62759e2495 +Subproject commit 9f70c118910f7174f65dac84c90d46d608d9cfd2 diff --git a/tools/onnx2bnn/OnnxConverter.cpp b/tools/onnx2bnn/OnnxConverter.cpp index 71219b4..9794f43 100644 --- a/tools/onnx2bnn/OnnxConverter.cpp +++ b/tools/onnx2bnn/OnnxConverter.cpp @@ -193,6 +193,7 @@ std::vector OnnxConverter::Convert( // for details. vector optimizers{ "eliminate_nop_pad", "extract_constant_to_initializer", + "dabnn_eliminate_dropout", "dabnn_convert_gemm_with_reshape_or_flatten_to_conv_and_reshape", "dabnn_bconv_strict"}; if (level == Level::kModerate || level == Level::kAggressive) { @@ -510,11 +511,6 @@ std::vector OnnxConverter::Convert( 0, 0, 0, 0, 0, 0, param); layers_.push_back(layer); VLOG(5) << "Converting Concat completed"; - } else if (op == "Dropout") { - VLOG(5) << "Start converting Dropout"; - // Dropout does nothing, so the output is the same as the input - name_map_[node.output(0)] = m(node.input(0)); - VLOG(5) << "Converting Dropout completed"; } else if (op == "Reshape") { VLOG(5) << "Start converting Reshape"; has_reshape = true;