forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fx quant: fix edge case with copynode after user function (pytorch#55710
) Summary: Pull Request resolved: pytorch#55710 In the current code, there is an edge case which leads to an error after the prepare step: 1. have a pattern like this: ``` user_func_unmatched_to_qhandler -> node_matched_to_copy_node_qhandler ``` 2. the user function returns a type which is not observable (i.e. not a Tensor) 3. if this is run through `prepare_fx`, calibrating it with data leads to a runtime error, because observers cannot observe non-tensor types. This PR fixes the issue. If a node matched to `CopyNodeQuantizeHandler` is after an unmatched node, we delete the observer. Test Plan: ``` python test/test_quantization.py TestQuantizeFx.test_no_obs_between_unmatched_node_and_copy_node ``` Imported from OSS Reviewed By: jerryzh168 Differential Revision: D27686811 fbshipit-source-id: 320be41b1f383c6352ff89fb39a9f480822a3bb2
- Loading branch information
1 parent
3f8d476
commit ec9b20d
Showing
2 changed files
with
61 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters