tree: f97452acbb217648ff7e383fc5a8ca0a3306bea6 [path history] [tgz]
  1. __init__.py
  2. _common_operator_config_utils.py
  3. native.py
  4. observation_type.py
  5. README.md
  6. tensorrt.py
  7. utils.py
torch/ao/quantization/backend_config/README.md

The patterns are we matching against is float modules types, functional operators and pytorch operators in reverse order:

operator = module_type | functional | torch op | native op | MatchAllNode
Pattern = (operator, Pattern, Pattern, ...) | operator

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. For example, pattern (nn.ReLU, (operator.add, MatchAllNode, (nn.BatchNorm2d, nn.Conv2d))) would match the following graph:

tensor_1            tensor_2
 |                    |
 *(MatchAllNode)  nn.Conv2d
 |                    |
 |             nn.BatchNorm2d
 \                  /
  -- operator.add --
         |
      nn.ReLU

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.