Browse Source

pnnx functionize do not create shadow op for identity consumers (#5632)

tags/20240820
nihui GitHub 1 year ago
parent
commit
789d8686c7
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 0 deletions
  1. +12
    -0
      tools/pnnx/src/pass_level2.cpp

+ 12
- 0
tools/pnnx/src/pass_level2.cpp View File

@@ -1166,6 +1166,18 @@ static void functionize(Graph& graph)
if (out0->consumers.size() == 1)
continue;

bool all_consumers_are_same = true;
for (size_t j = 1; j < out0->consumers.size(); j++)
{
if (out0->consumers[j] != out0->consumers[0])
{
all_consumers_are_same = false;
break;
}
}
if (all_consumers_are_same)
continue;

for (int j = (int)out0->consumers.size() - 1; j > 0; j--)
{
Operator* op1 = out0->consumers[j];


Loading…
Cancel
Save