Commit 161cd2c
[Transformation] Identity with Result removal transformation workaround (#33175)
### Details:
- Now correctly removes all Identity op from graph even in Result edge
cases where the input node has another Result attached to it
- Unlocks #33166
### Tickets:
- 177222
### Explaination:
When trying to convert graph:
```
p0 -> I0 -----\
Multiply ---- Result1
p1 -> I1 -----/ \
I2 ----- Result2
```
to
```
p0 ----\
Multiply ---- Result1
p1 ----/ \
Result2
```
the issue arises since Multiply outputs 1 tensor: T1, with a name "t1".
Since Identity is a copy operation, then the I2 outputs a new tensor T2
with a name "t2". After removing I2, we need to keep T2, but Multiply
has only one output, T1. The possible solutions were:
- Keep only Multiply’s name "t1": Result2 now would have to have source
tensor renamed to "t1"
- Keep only Identity’s name "t2": Result1 Result2 now would have to have
source tensor renamed to "t2"
- Merge (union) them: both old names still exist, but the tensor’s name
set changed vs the original one
- And the fourth one, replace I2 with another OP. This would generate a
new tensor "t2" from "t1" and if the new OP effectively "does nothing",
the names would be kept
So for now, there is no satisfactory solution. Therefore a workaround
for the NPU plugin is to use another OP: in this PR I decided to replace
I2 edge case with Reshape to have the marginal performance loss, if any.
It won't be eliminated with optimizations for the same reasons why I2
cannot be eliminated.
---------
Co-authored-by: Mikhail Ryzhov <mikhail.ryzhov@intel.com>1 parent 5604706 commit 161cd2c
2 files changed
Lines changed: 74 additions & 1 deletion
File tree
- src/common/transformations
- src/transformations/common_optimizations
- tests/common_optimizations
Lines changed: 32 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
856 | 857 | | |
857 | 858 | | |
858 | 859 | | |
859 | | - | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
860 | 891 | | |
861 | 892 | | |
862 | 893 | | |
| |||
Lines changed: 42 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2151 | 2151 | | |
2152 | 2152 | | |
2153 | 2153 | | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
0 commit comments