[POT] Update patterns (#9786)

* Update special_patterns.py

* add pattern in docs
This commit is contained in:
Indira Salyahova
2022-01-26 14:59:51 +03:00
committed by GitHub
parent cf49cd6ce8
commit 17c394c8fe
2 changed files with 21 additions and 0 deletions

View File

@@ -347,6 +347,18 @@ graph TB
---
**Name:** softmax<br/>
**Pattern:** <br/>
```mermaid
graph TB
exp(Exp) --> reduce(ReduceSum)
exp(Exp) --> divide(Divide)
reduce_const(Const) --> reduce(ReduceSum)
reduce(ReduceSum) --> divide(Divide)
```
---
**Name:** softmax_reshape_matmul<br/>
**Pattern:** <br/>

View File

@@ -144,6 +144,15 @@ def create_softmax_pattern():
return pattern.set_name('softmax').pattern
@registry_ignore_patterns('blocks')
def create_softmax_div_pattern():
pattern = PatternBuilder()
exp_out = pattern.append_single_op('Exp', 'exp').get_last_node()
reduce_out = pattern.append_op_const('ReduceSum', 'reduce').get_last_node()
pattern.insert_single_op([exp_out, reduce_out], None, 'Divide', 'div')
return pattern.set_name('softmax_div').pattern
@registry_ignore_patterns('blocks')
def create_softmax_reshape_matmul_pattern():
pattern = PatternBuilder()