From 33e97e994db8e7e6e275dec6daf538f07f0e8d28 Mon Sep 17 00:00:00 2001 From: Smirnov Egor Date: Tue, 30 Nov 2021 15:42:20 +0300 Subject: [PATCH] add sum of 1 input --- modules/dnn/src/onnx/onnx_importer.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/dnn/src/onnx/onnx_importer.cpp b/modules/dnn/src/onnx/onnx_importer.cpp index d70a81b..7af095e 100644 --- a/modules/dnn/src/onnx/onnx_importer.cpp +++ b/modules/dnn/src/onnx/onnx_importer.cpp @@ -929,6 +929,14 @@ void ONNXImporter::parseBias(LayerParams& layerParams, const opencv_onnx::NodePr opencv_onnx::NodeProto node_proto = node_proto_; const std::string& layer_type = node_proto.op_type(); bool isSub = layer_type == "Sub"; + + if (layer_type == "Sum" && node_proto.input_size() == 1) + { + layerParams.type = "Identity"; + addLayer(layerParams, node_proto); + return; + } + CV_Assert((node_proto.input_size() == 2) || (layer_type == "Sum" && node_proto.input_size() > 2)); if (layer_type == "Sum" && node_proto.input_size() > 2) -- 2.7.4