pytorch
59c1b502 - [quant][fx][pt2e] Refactor prepare so it's aligned better with the new API plan in pt2e (#94011)

Comment changes are shownComment changes are hidden
Commit
2 years ago
[quant][fx][pt2e] Refactor prepare so it's aligned better with the new API plan in pt2e (#94011) Summary: There are three things that happens in the current prepare code, (1). user express their intention of how they want the model to be quantized with QConfigMapping, we translate that to node.meta["target_dtype_info"] (2). we validate the setting against BackendConfig (3). insert observers based on the validated node.meta["target_dtype_info"] previously (2) and (3) are mixed together, this PR tries to move (2) closer to (1), with one edge case left, this refactor moves us closer to our target design for quantization in pytorch 2.0 export path this is a follow up PR for https://github.com/pytorch/pytorch/pull/92641 Test Plan: python test/test_quantization.py TestQuantizeFx python test/test_quantization.py TestQuantizeFxOps python test/test_quantization.py TestQuantizeFxModels Reviewers: Subscribers: Tasks: Tags: Pull Request resolved: https://github.com/pytorch/pytorch/pull/94011 Approved by: https://github.com/vkuzo
Author
Committer
Parents
  • torch/ao/quantization
    • fx
      • File
        prepare.py
    • File
      qconfig.py
Loading