Skip to content

dnn onnx: something wrong after cummutative ops are support in onnx graph simplifier #24568

@fengyuentau

Description

@fengyuentau

System Information

Tried with code before and after #24483 and also latest.

Detailed description

I am working on the subgraph fusion for BiasGelu. Model is attached here bias_gelu.onnx.zip. Its graph pattern looks like the following,

[Input] -> Add(bias) -> Gelu_pattern -> [Output]

The ONNX simplifier in dnn can already handle the Gelu pattern.

I added the following test case in test_graph_simplifier.cpp to check layer types after fusion,

TEST_F(Test_Graph_Simplifier, BiasGeluSubGraph) {
    test("bias_gelu", "Gelu");
}

and found that:

  1. Before the merge of Commutative rules for DNN subgraphs fusion #24483 (Cummutative rules), layer types after simplification are correct, which are { "Gelu", "NaryEltwise" }.
  2. After the merge of Commutative rules for DNN subgraphs fusion #24483 (Cummutative rules), layer types are incorrect, which are { "Erf", "NaryEltwise" }.
  3. Also tried latest code, and it is the same result as the above 2.

Steps to reproduce

Download model and add the test case.

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions