Skip to content

Commit c59c867

Browse files
jerryzh168facebook-github-bot
authored andcommitted
[quant] Add back README.md for backend_config (#70964)
Summary: Pull Request resolved: #70964 Accidently deleted before, adding this back. We'll make this more complete after the structure is finalized Test Plan: no test needed Imported from OSS Reviewed By: dagitses Differential Revision: D33470738 fbshipit-source-id: 00459a4b00514d3d0346de68788fab4cad8a5d12
1 parent 00e5610 commit c59c867

File tree

1 file changed

+20
-0
lines changed
  • torch/ao/quantization/fx/backend_config

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The patterns are we matching against is float modules types, functional operators and pytorch operators in reverse order:
2+
```
3+
operator = module_type | functional | torch op | native op | MatchAllNode
4+
Pattern = (operator, Pattern, Pattern, ...) | operator
5+
```
6+
where the first item for Pattern is the operator we want to match, and the rest are the patterns for the arguments of the operator.
7+
For example, pattern (nn.ReLU, (operator.add, MatchAllNode, (nn.BatchNorm2d, nn.Conv2d))) would match the following graph:
8+
```
9+
tensor_1 tensor_2
10+
| |
11+
*(MatchAllNode) nn.Conv2d
12+
| |
13+
| nn.BatchNorm2d
14+
\ /
15+
-- operator.add --
16+
|
17+
nn.ReLU
18+
```
19+
20+
we’ll match the last node as the anchor point of the match, and we can retrieve the whole graph by tracing back from the node, e.g. in the example above, we matched nn.ReLU node, then node.args[0] is the operator.add node.

0 commit comments

Comments
 (0)