Merge pull request #21865 from rogday:nary_eltwise_layers
authorrogday <s.e.a.98@yandex.ru>
Tue, 19 Jul 2022 03:14:05 +0000 (06:14 +0300)
committerGitHub <noreply@github.com>
Tue, 19 Jul 2022 03:14:05 +0000 (06:14 +0300)
commited69bcae2d171d9426cd3688a8b0ee14b8a140cd
tree554f1699a0e88314e8bb7d836d246a37b3b46234
parent728545468cdaeb0a5585f48c76c7994dee70c8dd
Merge pull request #21865 from rogday:nary_eltwise_layers

Reimplementation of Element-wise layers with broadcasting support

* init

* semi-working initial version

* add small_vector

* wip

* remove smallvec

* add nary function

* replace auto with Mat in lambda expr used in transform

* uncomment asserts

* autobuffer shape_buf & step_buf

* fix a missing bracket

* fixed a missing addLayer in parseElementWise

* solve one-dimensional broadcast

* remove pre_broadcast_transform for the case of two constants; fix missing constBlobsExtraInfo when addConstant is called

* one autobuffer for step & shape

* temporal fix for the missing original dimension information

* fix parseUnsqueeze when it gets a 1d tensor constant

* support sum/mean/min/max with only one input

* reuse old code to handle cases of two non-constant inputs

* add condition to handle div & mul of two non-constant inputs

* use || instead of or

* remove trainling spaces

* enlarge buf in binary_forward to contain other buffer

* use autobuffer in nary_forward

* generate data randomly and add more cases for perf

* add op and, or & xor

* update perf_dnn

* remove some comments

* remove legacy; add two ONNX conformance tests in filter

* move from cpu_denylist to all_denylist

* adjust parsing for inputs>=2

Co-authored-by: fengyuentau <yuantao.feng@opencv.org.cn>
modules/dnn/include/opencv2/dnn/all_layers.hpp
modules/dnn/perf/perf_layer.cpp
modules/dnn/src/init.cpp
modules/dnn/src/layers/nary_eltwise_layers.cpp [new file with mode: 0644]
modules/dnn/src/onnx/onnx_importer.cpp
modules/dnn/test/test_onnx_conformance_layer_filter_opencv_all_denylist.inl.hpp
modules/dnn/test/test_onnx_conformance_layer_filter_opencv_cpu_denylist.inl.hpp